February 22, 2000 - Detecting IE 5.5 | WebReference

February 22, 2000 - Detecting IE 5.5

Yehuda Shiran February 22, 2000
Detecting IE 5.5
Tips: February 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Internet Explorer is going to be released within a few months. The beta version is already out. The new version includes many new features that we will cover in our columns. To take advantage of the new features, and still be compatible with Internet Explorer 5.0, you need to be able to detect the new version.

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":


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:


Finally, convert the string to a floating number: