Found problem with values of verions of IE8. Please, see the pics.

1) When I check navigator.appVersion it shows version 7.

enter image description here

2) But when I open Info->About IE, it shows that version is 8:

enter image description here

How it can be? It can make problems when I check user's browser version.

有帮助吗?

解决方案

One reason this happens can be you beeing in a different layout mode (check F12/Developer Tools).

Regardless of the navigator telling you something wrong. You should NEVER do Feature detection through Browser identification! Always test if the function is there or not! Like addEventListener. Instead of checking document.all (which for a long time was microsoft only) to determin if you'd use addEvent or addEventListener, check if addEventlistener is in the document;

if (document.addEventListener){
    document.addEventListener(....
}
else{
    document.addEvent(...
}

There is a library called Modernizr which does all the ever needed feature detections for you (and is modular) and even adds CSS classes to style things when expl. IE6 doesn't support opacity

hope I helped!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top