wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes navigator.userAgent wrong IE version detection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "navigator.userAgent wrong IE version detection" Watch "navigator.userAgent wrong IE version detection" New topic
Author

navigator.userAgent wrong IE version detection

Liwuen Chew
Greenhorn

Joined: Mar 11, 2010
Posts: 24
Greetings!
Hope someone can help me with this. I'm running a JS function which uses the navigator.userAgent string to get the browser's main information (Among this there is the browser version).
My problem is that, for some reason, navigator.userAgent return version 7 as the actual version when the script is run in IE9. Tried with different browsers and all of them work fine, is just IE the one that is having detection issues.
Can you please help me onto getting the reason why it detects wrongly the IE version? Thanks in advance!
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Your browser is running in IE7 mode in IE9. It is right, your sniffing is wrong.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Browser sniffing is generally regarded as a poor practice -- rather, features detection is preferred.

For what reason as you sniffing the browser?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: navigator.userAgent wrong IE version detection