Thanks a lot Mike, I've tried, it works perfectly! I would like to add FF 1 and IE 5 which are not supported too. Could you tell me if my code is correct... I think I did an error:
<script type="text/javascript"> // See http://developer.apple.com/internet/safari/uamatrix.html for Safari versions if(( $.browser.safari && $.browser.version < 523 ) || ( $.browser.msie && $.browser.version < 6 ) || ( $.browser.mozilla && $.browser.version < 2.0.0.6 )) document.write( '<a href="test.html" target="_blank">test</a>' ); else document.write( '<a href="test.html?height=300&width=300" title="add a caption to title attribute / or leave blank" class="thickbox">test</ a>' ); </script> On 4 mai, 20:48, "Michael Geary" <[EMAIL PROTECTED]> wrote: > Like this? > > // Seehttp://developer.apple.com/internet/safari/uamatrix.htmlfor > Safari versions > > if( $.browser.safari && $.browser.version < 523 ) > document.write( '<a href="test.html" target="_parent">test</a>' ); > else > document.write( '<a href="test.html?height=300&width=300" title="add > a caption to title attribute / or leave blank" class="thickbox">test</a>' ); > > As an aside, note how the use of single quotes for the strings avoids the > need of escaping the double quotes inside the strings. > > -Mike > > > I saw there were a Browser Detect included with jQuery. > > > I would like to use two different code line in my Web page depending > > of the browser version: > > > If the browser is Safari and the version is older than 3, the code > > line is: > > <a href="test.html" target="_parent">test</a> > > Else (for all other browsers including Safari 3), the code line is: > > <a href="test.html?height=300&width=300" title="add a caption to title > > attribute / or leave blank" class="thickbox">test</a> > > > I would like to use ThickBox script in my Web page, but this script > > runs correctly on Safari 2.0.4+ and my Web page has to be compatible > > with older version of Safari too! > > > I'm not really a Web Developper... I learn how to! > > Could you help me to write a script which can detect the Safari > > version and apply the good code in the page? > > > I've tried the code below, but it doesn't look good! > > > <SCRIPT language="JavaScript"> > > <!-- > > var browserName=navigator.appName; > > var browserVer=parseInt(navigator.appVersion); > > if ((browserName=="Safari" && browserVer=1) || (browserName=="Safari" > > && browserVer=2)) > > { > > document.write("<a href=\"test.html\" target=\"_parent\">test</a>"); > > } > > else > > { > > document.write("<a href=\"test.html?height=300&width=300\" title=\"add > > a caption to title attribute / or leave blank\" class=\"thickbox > > \">test</a>"); > > } > > //--> > > </SCRIPT> > > > Thanks a lot for your help :) > > Chris