What is IE9 compatibility view in IE9 Developer tools?

柔情痞子 提交于 2019-12-06 06:27:16

问题


I am looking at IE 9 developer tools and when I click on browser mode I get a list

IE 7
IE 8
IE 9
IE 9 Compatibility View 

What does that do? What is the difference between IE 9 and IE 9 Compatibility View ?


回答1:


The main difference is the User-Agent string. For Internet Explorer 9, the new and improved UA string is sent:

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)

For compatibility view, something similar to the following string will be sent:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; Zune 4.7)

Notice how the compatibility view UA string identifies the browser as MSIE 7.0? Document mode isn't enough for compatibility view to work as intended. The reason for this is you can't truly be backwards compatible if you still tell the web server you're running IE 9 — it may have some server side code that identifies IE 7 browsers and dishes out content specific to that browser. Thus, the developer tools gives you the opportunity to see how your web page would look if a user clicked the "Compatibility View" icon, without switching compatibility view on permanently.

For the sake of completeness, it's also worth mentioning that the app version string changes in a similar way. IE 9's app version string is:

5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)

And in compatibility view (may vary depending on software installed):

4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; Zune 4.7)

These strings are very similar to the UA string, but client-side scripts may refer to this string instead of the UA string. IE 9 can still be identified in both the UA string and the app version string from the Trident/5.0 part, regardless of compatibility mode.




回答2:


In principle, 9 Compatibility View is the features of MSIE 9 but with certain capabilities backed up to be compatible with MSIE 7. Also in principle, 7 is the same as MSIE 7, and 8 is the same as MSIE 8. But in fact, if you toggle to 7 and back to 9 Compatibility View, it behaves somewhat differently from just starting in 9 Compatibility View. Also, there are significant differences between 7 and the original MSIE 7.0. Therefore, it is impossible to give a clear complete and accurate answer to your question.



来源:https://stackoverflow.com/questions/5465584/what-is-ie9-compatibility-view-in-ie9-developer-tools

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!