|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am very new to javascript.
I just couldn't figure out a way to differentiate between the two. The navigator.appVersion gives me 4.0 for both IE4 and IE5 Please Help !! |
|
#2
|
|||
|
|||
|
Yeah I discovered this as well and its very annoying. The way around it is to do this -
function checkBrowser(){ var version if ((navigator.appVersion.substring(22,23) == "4") && (navigator.appName=="Microsoft Internet Explorer")){ version="IE4"; //IE4 }else{ version="Other"; //IE5 } } This is because the difference in version number is in the middle of the very long number string, not at the start. Hope this helps. Matt. <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by anand: I am very new to javascript. I just couldn't figure out a way to differentiate between the two. The navigator.appVersion gives me 4.0 for both IE4 and IE5 Please Help !![/quote] |
|
#3
|
||||
|
||||
|
//browsercheck by thomas brattli @ www.bratta.com//
function checkBrowser(){ this.ver=navigator.appVersion; this.dom=document.getElementById?1:0; this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; this.ie4=(document.all && !this.dom)?1:0; this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; this.ns4=(document.layers && !this.dom)?1:0; this.B=(this.ie5 | | this.ie4 | | this.ns4 | | this.ns5); return this } B=new checkBrowser(); this detects ie5 and ns6 via the dom, to use it you would test for if(B.ie4) - or if(B.dom) for ie5 etc ------------------ Simon Wheeler FirePages -DHTML/PHP/MySQL |
|
#4
|
|||
|
|||
|
Thanks Guys !!!
|
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Differentiate between IE4 & IE5 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|