spacer
Yehuda Shiran January 25, 2000
Version Detection
Tips: January 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

When you want to sniff the browser version, be aware that Internet Explorer and Netscape Navigator have different version assignment schemes. The version information can be found in the navigator object's appVersion property. If we print this property from Internet Explorer, it looks like this:

The printout from Netscape Navigator will look like this:

Notice that Internet Explorer shows two versions, 4.0 and 5.0 in the example above. The Compatible Version (4.0) denotes the previous compatible version. The other version (5.0) denotes the actual version of the browser. Netscape Navigator shows just one number, the current version number (4.08). So how do we extract the version? If we are interested in the compatible version (4.0), then we can use the parseFloat() method. It always returns the compatible version on the Internet Explorer and the normal browser version on Netscape Navigator. If you need the browser version in Internet Explorer, you have to resort to the indexOf() method. Use it to locate specific substrings and then convert them to float. Check your browser's version now:

Learn more about the appVersion property in Jan 14, 2000's tip.


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