Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I Detect Multiple Browsers?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Could someone provide code, either in HTML or JavaScript to detect different browsers and browser versions so that I can execute code based on such information.

Thanks in advance.
 
Hello,

I think you need this (The text below within the parentheses should be all on one line.):

<SCRIPT LANGUAGE=&quot;javascript&quot;>
var an = navigator.appName;
var av = navigator.appVersion;
var acn = navigator.appCodeName;
var ua = navigator.userAgent;
document.write(&quot;You are using <B>&quot; +an+
&quot;</B>, version &quot; +av+ &quot;.<BR>Its code name is &quot;
+acn+ &quot;, and sends the header &quot; +ua+ &quot;.&quot; );
</SCRIPT>


good luck,

<Mr. Developer/>
 
Almost works, Mr. Developer.

I built a little test app and ftp’d it as On a backup PC, the test app correctly recognized the browser properly as I.E. 4.0,
On the same machine, the app recognized Netscape 6.01 as Netscape 5.0,
And on this PC, the app also incorrectly recognized IE 5.5 as IE 4.0.

Because I wasn’t sure where I could break up the code and put part of it inside the head tags, I placed the entire thing, verbatim, inside the body, cut and paste from your example.

Thank you for your help. I’m getting closer but am not quite where I need to be yet.

-Al
 
A little further research led me to realize that what I have is enough to generate separate style sheets, one for NS and one for IE and even tho the way the script reported versions looke funny, inside the parentheses of the report was exactly what I wanted. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top