I. Compatibility View of IE browser
The Compatibility View is designed to be compatible with websites developed based on other web page standards. It ensures that the majority of Internet users do not suffer from confusion in Webpage display when Browsing webpages.IE8Added a practical feature. When IE8 detects that a website is incompatible, The Compatibility View button appears on the right side of the address bar. You only need to click a button and most webpages will be displayed normally. (The webpage will be displayed in IE7 code specifications)
It introduces two important concepts: "browser mode" and "document mode ";
Note: You can also press F12 to enter the developer tool to view the browser mode and document mode of the current page.
Ii. Document Mode
Specify the version of the IE page layout engine to parse and render HTML. When switching, the webpage will be refreshed, but its browser mode version will not change or be re-downloaded from the server. When the browser mode is changed, the browser automatically switches to the corresponding document mode.
3. browser Mode
It is used to switch the default document mode of IE for the webpage, parse the conditional remarks of different browsers, and send the User-Agent string to the website server. The website can determine the browser version and installation function based on different user agent strings returned by the browser, so that different page content can be returned to different browsers.
Iv. Test the JS Code of the document model of the current IE browser
In addition to entering the developer tools by pressing F12 to view the browser mode and document mode of the current page, you can also view the document mode used on the current page through Js, it is mainly determined by the documenmode attribute.
To simulate different ie versions, add <meta http-equiv = "X-UA-compatible" content = "Ie = 7"> </meta> under the title,Must be placed in the line next to the title.
When Ie = 7 is set, documentmode = 7; if IE = 8, documentmode = 8; If ie9 is set, documentmode = 9
If ie9 is installed on the current machine, even if you change it to IE = 10, documentmode is still equal to 9; if you set Ie = 5 or IE = 6, documentmode is always equal to 5, that is, the quirks mode.
Example:
</body>
Document mode and IE browser Mode