[thelist] Browser Detect - IE6 = NN4?
Jon Hall
jonhall at ozline.net
Sun Jan 13 03:36:25 CST 2002
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;
if(ns4) setCookie('ns4');
if(ie4) setCookie('ie4);
and so on...
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.
jon
Ken Kogler wrote:
>http://www.kenkogler.com/browse.asp
>
>Very simple code:
>
><code>
> <%
> 'Create an instance of the Browser Capabilities Component
> Dim objBC
> Set objBC = Server.CreateObject("MSWC.BrowserType")
> %>
> <b>Your browser:</b> <%=objBC.Browser%><br>
> <b>Browser version:</b> <%=objBC.Version%><br>
> <b>Support Frames?</B> <%=objBC.Frames%><br>
></code>
>
>That's it. This is supposed to (among other things) detect my browser.
>I'm using IE6.0 under WinXP Pro, and this code tells me I'm running
>Netscape 4.00.
>
>Anyone know what the heck's going on? I've got the following browsers
>installed:
>NN4.0
>NN6.02
>Opera 4
>Opera 5
>Mozilla 0.9
>IE6
>
>NN4, IE6, and Opera 5 all return NN4. Opera 4 returns correctly, and NN6
>and Mozilla both choke and return "Default 0.00". You'd think microsoft
>would be able to detect it's own browsers.
>
>Anybody know a better browser dectection method to separate the Netscape
>4.X users? (I'm using this script to decide on a size for my <input>
>elements. NN4.x users get half the value of everyone else.)
>
>Thanks, guys (and gals)!
>
>Ken Kogler
>
>
More information about the thelist
mailing list