faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 9 people (44%) answered Yes
Recently 4 of 9 people (44%) answered Yes


How do I cause a SPECIFIC hyperlink to go to a different page, only if the visitor is using IE6

Apr 7th, 2008 22:57
ha mo, Abolfazl Shirazi, rod aries,

Abolfazl Shirazi:
Well, I guess that you don't have any problem with getting the browser 
name. As you know "navigator.appName" will return the name of the 
browser in javascript (For Example Microsoft Internet Explorer) But 
getting the Browser Version may be a problem and if you know how you 
can get it, you will be able to solve your problem easily.
The page below verify the browser name and then browser version and 
after that it make a suitable link to somewhere.
Just try It:
<!-- Begin -->
function window.onload()
BVersion = BodyTag.getComponentVersion ("{89820200-ECBD-11CF-8B85-
BName = navigator.appName
BNameField.innerHTML = BName
BVersionField.innerHTML = BVersion
if (BName == "Microsoft Internet Explorer" && BVersion.charAt(0) 
== "6") {
	LinkField.href = "http://www.faqts.com/"
	LinkField.innerHTML = "Go To FAQTS"
else {
	LinkField.href = "http://www.yahoo.com/"
	LinkField.innerHTML = "Go To Y!"
<BODY STYLE="behavior:url(#default#clientcaps)" ID="BodyTag">
The Browser Name is : <b><span id="BNameField"></span></b><br>
The Browser Version is : <b><span id="BVersionField"></span></b><p>
If the visitor use IE6, there should be a link to faqts.com below. 
Otherwise there should be a link to yahoo.com below.
<a name="LinkField"></a>
<!-- End -->
Have Fun!