HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
The Best Selling PC Migration Utility.
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 8th, 1999, 09:20 PM
Dan
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Hi, I could really need some help on this one!
My script loses it's memory at some point, can you find why?

This script is supposed to
A) detect the visitors OS
B) Determine wether it's IE4+, NS4+ or whatever below version 4
C) Load the appr .js files depending on detected browser.

This is what it does and what happens:

When it's IE4+ on 32 bit OS it should load one ext.js and write a IE-navigation from another ext.js

When it's NS4+ on 32 bit OS it should load two other ext.js and write a NS-navigation from another ext.js

When it's "Something else" it should load one empty ext.js and write a standard-navigation from an ext.js

I've got a simpler version at my site right now that only differs between IE4+ and "Something else" and this works great.

My problem is that now, when I took NS4+ into the equation this happens:

It recognises NS4+ on 32 bit OS all the way through.

It recognises "Something else" all the way through.

It recognises IE+ on 32 bit OS in choosing ext navscript and loadscript but loses it when it comes to the navigation.

The really wierd thing is that if I comment out the NS parts, It recognises IE4+ all the way through...

Where have I gone wrong??? At this point I'm totally lost and feel like an idiot...

Here is the script, Its commented where it works and not, there is also a lot of alerts in there, that plus "theBrowser" is just so I can see where it loses it.

You can also try it on an example page at:
http://home.bip.net/dan.segolson/test/Test%20IE-NS.htm

I would really like some help on this...
Thanx Dan, Sweden

<SCRIPT LANGUAGE="JavaScript">

/* ----------------------------------------------------------------
sniffing code to detect for IE4 or better on either Windows NT or 95
or NS4+ on either Windows NT or 95 and the load the appropriate
external scripts for the visiting browser
---------------------------------------------------------------- */

var sAgent = navigator.userAgent

var bIs95NT
= sAgent.indexOf("Windows 95") > -1
| | sAgent.indexOf("Windows NT") > -1
| | sAgent.indexOf("WinNT") > -1
| | sAgent.indexOf("Win95") > -1
| | sAgent.indexOf("Win32") > -1
| | sAgent.indexOf("Windows 98") > -1
| | sAgent.indexOf("Win98") > -1
alert("32bit OS is '"+ bIs95NT +"' .");
//Works OK

var bIsIE4
= sAgent.indexOf("MSIE") > -1
&& sAgent.indexOf("4") >= 4
&& sAgent.indexOf("b1") <= -1
&& sAgent.indexOf("p1") <= -1
var bIsIE432 = bIs95NT && bIsIE4
alert("Browser IE4 + on 32 bit OS is '"+ bIsIE432 +"' .");
//Works OK

var bIsNS4
= sAgent.indexOf("MSIE") <= -1
&& sAgent.indexOf("4") >= 4
var bIsNS432 = bIs95NT && bIsNS4
alert("Browser NS4 on 32 bit OS + is '"+ bIsNS4 +"' .");
//Works OK

var theBrowser
if (bIsIE432) theBrowser = "MSIE 4 på 32 bit OS";
if (bIsNS432) theBrowser = "Netscape 4 på 32 bit OS";
else theBrowser = "IE under 4 eller NS under 4";
alert("Browser is '"+ theBrowser +"' .");
//Forgets that it is IE4+

var theNavigation
if (bIsIE432) theNavigation = "navstyle.js";
if (bIsNS432) theNavigation = "nsmenu.js";
else theNavigation = "stdlink.js";
alert("Chosen navigation is '"+ theNavigation +"' .");
//Forgets that it is IE4+

var theNavscript
if (bIsIE432) theNavscript = "navscr.js";
if (bIsNS432) theNavscript = "menu.js";
else theNavscript ="noload.js"
alert("Chosen navscript is '"+ theNavscript +"' .");
//Works OK

var theLoad
if (bIsIE432) theLoad = "noload.js";
if (bIsNS432) theLoad = "menuload.js";
else theLoad ="noload.js"
alert("Chosen onloadscript är '"+ theLoad +"' .");
//Works OK


document.write('<SCR'+'IPT SRC="' + theNavscript + '"></SCR'+'IPT>');
document.write('<SCR'+'IPT SRC="' + theLoad + '"></SCR'+'IPT>');
document.write('<SCR'+'IPT SRC="' + theNavigation + '"></SCR'+'IPT>');
//Works OK

</SCRIPT>
***********THE END...***************


Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > My script seems to lose it's memory...Help me?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway