Add in source code:
The code is as follows: |
Copy code |
<Meta http-equiv = "X-UA-Compatible" content = "IE = edge, chrome = 1 & Prime;/> |
IE = edge tells IE to use the latest engine to render web pages. chrome = 1 can activate Chrome Frame.
In this way, if Google Chrome Frame (Google embedded browser framework GCF) is installed, GCF is used to render the page. If GCF is installed, use the IE kernel of the highest version for rendering.
Chrome Frame allows the old version of IE browser to use Chrome's WebKit rendering engine to process web pages. Therefore, the old version of IE users can experience many modern web page technologies, including HTML5.
Tag usage (add the X-UA-Compatible tag to the website ):
1. Basic usage: add a header to the page
The code is as follows: |
Copy code |
<Meta http-equiv = "X-UA-Compatible" content = "chrome = 1 & Prime;/> |
It is used to declare that the current page is rendered using the chrome kernel.
The complexity is the usage in the beginning of this article:
The code is as follows: |
Copy code |
<Meta http-equiv = "X-UA-Compatible" content = "IE = edge, chrome = 1 & Prime;/> |
In this way, if GCF is installed, GCF is used to render the page. If GCF is installed, the highest version of IE kernel is used for rendering.
Use CFInstall. js to check whether GCF is installed in the current IE browser?
Using the strange features of IE, if this tag does not exist in the DOM dictionary, you can use document. createElement of js to create it, and it will be added to the DOM dictionary for identification;
Taobao adds comments
The code is as follows: |
Copy code |
<! -[If IE]> <Script src = "http://a.tbcdn.cn/p/fp/2011a/html5.js”> </script> <! [Endif]-> |
I wrote it like this:
The code is as follows: |
Copy code |
<! -[If IE]> <Script type = "text/javascript" src = "http://ajax.googleapis.com/ajax/libs/chrome-frame/1/cfinstall.min.js"> </script> <Style> . ChromeFrameInstallDefaultStyle { /* Default is 800px width: 800px ;*/ Border: 5px solid blue; . ChromeFrameOverlayContent . ChromeFrameOverlayContent iframe . ChromeFrameOverlayCloseBar . ChromeFrameOverlayUnderlay } </Style> <Script> // The conditional ensures that this code will only execute in IE, // Therefore we can use the IE-specific attachEvent without worry Window. attachEvent ("onload", function (){ CFInstall. check ({ Mode: "overlay ", Node: "prompt ", Destination: http://clin003.com" }); }); </Script> <! [Endif]-> |
The above code can automatically detect whether the installation of GCF, if not installed, will prompt the user to install, after the installation is complete, or automatically jump to the http://www.111cn.net.
For more details, refer
Chrome development documentation Chrome Frame: Developer Guide
Microsoft official documentation Specifying Document Compatibility Modes
X-UA-Compatible is a dedicated identifier of IE8. It tells IE8 which Internet Explorer version is used to render webpages (for example, IE6, which is annoying ). However, during the IE6 test, the system prompts you to install GFC.
IE version: ie6.0.0.2900.5512.xpsp _ sp3_gdr.101209-1647
In IE6, the system prompts you to install GFC.
After the installation is successful, the system automatically redirects to the specified page to see the chrome rendering effect.