• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

navigator.userAgent wrong IE version detection

 
Liwuen Chew
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your browser is running in IE7 mode in IE9. It is right, your sniffing is wrong.

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Browser sniffing is generally regarded as a poor practice -- rather, features detection is preferred.

For what reason as you sniffing the browser?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic