[thelist] Browser Detect - IE6 = NN4?

aardvark roselli at earthlink.net
Sun Jan 13 12:35:34 CST 2002


> From: Jon Hall <jonhall at ozline.net>
>
> If you need to do your if's for the form in your asp code, set a
> cookie on the users machine when they hit your site that indicates
> which browser they are using, so the browser is always available.
> Something like this:
> 
> var ns4 = (navigator.appName.indexOf("Netscape")>=0 && 
> parseFloat(navigator.appVersion) >= 4 && 
> parseFloat(navigator.appVersion) < 5)? true : false;
> var ie4 = (document.all)? true : false;
> var ns6 = (parseFloat(navigator.appVersion) >= 5 && 
> navigator.appName.indexOf("Netscape")>=0 )? true: false;

except this now relies on both client-side script and cookies... i 
have both turned off at home...

why not use the @import method for CSS and avoid all browser 
testing altogether?  then even my browser would get the right view...

[...]
> I left out the setCookie fuction, just use your own cookie library.
> Then you can read the cookie in the server side code to get the
> browser. Calling a COM object just for browser detection seems a
> little heavy on server resources to me.

but if you have control over the server, do it there... it eliminates 
*any* concerns about client-side script support, and it makes it 
cleaner for those on slow machines or those without client-side 
scripting enabled...





More information about the thelist mailing list