Like this? // See http://developer.apple.com/internet/safari/uamatrix.html for 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 >