February 22, 2000 - Detecting IE 5.5
February 22, 2000 Detecting IE 5.5 Tips: February 2000
Yehuda Shiran, Ph.D.
|
As usually, the key is in the navigator.appVersion
property. In Internet Explorer 5.5, for example, this property looks like this:
4.0 (compatible; MSIE 5.5; Windows 98)
To extract the string "5.5"
, we would first get the position of "MSIE"
:
navigator.appVersion.indexOf("MSIE")
Then add 5 to get to the position of "5.5"
:
msieIndex = navigator.appVersion.indexOf("MSIE") + 5;
Then extract the three-character-long substring beginning at msieIndex
:
navigator.appVersion.substr(msieIndex,3)
Finally, convert the string to a floating number:
parseFloat(navigator.appVersion.substr(msieIndex,3))