View Full Version : browser detection
emma81
10-27-2002, 11:27 PM
Hi, I'm very new to javascrip and was wondering if anyone could help me with my problem.
I need to know how to code a button to detect a user's browser version and display it in an alert box??
I've looked up many resources and do not understand how to code browser detection within a button.
Any help would be greatly appreciated. Thankyou.
Emma
bacterozoid
10-28-2002, 01:05 AM
Wow, for being fairly incompetent at writing codes myself, I did a good job with this one!
In your head tag, put this:
<SCRIPT LANGUAGE="JavaScript">
function dothis() {
alert(navigator.appVersion) }
</SCRIPT>
Then, for your button, put this wherever you want it to appear on the page.
<input type="button" value="Button" name="button" onClick=dothis()>
An alternative:
<input type="button" value="Button" name="button" onClick=alert(navigator.appVersion)>
Use that if you don't feel like putting that extra script in your head tag.
To see it in action:
http://www.geocities.com/jon_zie/scripts/navigatorversion.htm
emma81
10-29-2002, 05:09 AM
Thankyou very much for helping me out- the code was so simple - i feel so stupid.
I'm starting to grasp it now
:))
bacterozoid
10-29-2002, 12:50 PM
Hey, no problem, we all feel stupid now and then. ;) You will get the hang of it in no time.
Mhtml
10-30-2002, 08:41 AM
Whammy and I worked on something to get browser names and versions but in the end Whammy made an extremly great script but it could only get the browser type 90% of the time, it is just not possible to get the browser type right every time..YET!
http://www.codingforums.com/showthread.php?s=&threadid=6586
brothercake
10-30-2002, 09:55 AM
I have this, which recognises the major browsers and groups all others together. I find it useful for scripting. http://www.brothercake.com/scripts/sniffer.php
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.