问题
If a webpage is retrieved from a website in the Local intranet zone, IE7 mode is used. -MSDN
So that's what happening with us. Client has set the option to "open intranet sites in compatibility mode". So at their place our application loads in IE7 mode.
Is there any way by which I can detect whether the client is running his IE in compatible mode?
As far as I know if the browser is in compatible mode then it sends IE7 user-agent string to Apache. So I can get that document mode is IE7, but I can't verify whether it's his native IE7 or the compatible one.
Anyone has any idea on how to detect the exact IE browser version from Apache and to detect whether it is in compatible mode or native mode?
回答1:
Here are user agent strings for IE that show the compatibility modes.
IE7: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1;...)
IE8: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0;...)
IE8 Compatibility View: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0;...)
IE9: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
IE9 Compatibility View: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0;...)
IE10 Compatibility View Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/6.0;...
IE11 Compatibility View : Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; Trident/7.0...)
The way to determine if it is native IE7
or 8
and 9
running in compatibility mode is that IE8 and IE9 will also contain the Trident
string.
So if you do a user_agent check in apache, for MSIE 7.0
and it also contains Trident/4.0
Then it's IE8
running in IE7 compatibility mode
.
Same with IE9
. If it has both MSIE 7.0
and Trident/5.0
then it's IE9
running in IE7 compatibility mode.
Otherwise, it the user_agent string only has MSIE 7.0
then it's native IE7.
That is probably the only way by user_agent. Hope that helps.
More info here.
http://msdn.microsoft.com/en-us/library/ie/hh869301(v=vs.85).aspx
Also here is a nice list too. http://www.useragentstring.com/pages/Internet%20Explorer/
来源:https://stackoverflow.com/questions/21670467/detect-ie-version-from-apache-in-case-of-compatibility-mode