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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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

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))


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint