View Full Version : A script which detects browser version ?

05-04-2008, 07:43 PM

I would like to use ThickBox script in my Web page (http://jquery.com/demo/thickbox/), but this script is supported on Safari 2.0.4+ and my Web page has to be compatible with Safari 2.0.3 too!

Do you know a script which detects browser version?

A script which allows to use a specific code line depending of the browser version, like:

if Safari 3 and other browsers (IE, FF, Opera...) =
<a href="ajaxOverFlow.html?height=300&width=300" title="add a caption to title attribute / or leave blank" class="thickbox">Scrolling content</a>
(ThickBox code)

if Safari 2 =
<a href="test.html" target="_parent">test</a>
(classic code)

Thanks a lot your help ;)

05-06-2008, 01:17 PM
there is a code which you can put in to detect which browser the user is using

if(navigator.appName == "Microsoft Internet Explorer")
alert("You are using Internet Explorer you may need to activate Active X before you can check your answers. If there is still a problem try using another broswer! If theres no problem ENJOY THE GAME!")
else alert("Your not using Internet Explorer so enjoy playing the quiz!");

that will alert the user what browser is being used but you can change it so if the user is using safari .... you can put document.write and then express what you want the java to do.

Hope this helps a bit

05-08-2008, 05:20 AM
Checkout this one


05-08-2008, 06:53 AM
Though tempting, browser detection should generally only be used for a specific browser or browsers that are troublesome in some way with your code, and then only as a provisional last resort, with the hope still remaining that a better method of code branching will be determined later. This is because, no matter how good the detect is, things will change in the future. Feature (object) detection is the right way to go.