spacer
Yehuda Shiran January 25, 2000
Version Detection
Tips: January 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

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, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business