About This DocumentThis document is for web developers who want their pages to work with Google Chrome Frame (aka, GCF). In most cases, making your pages work with GCF is trivial: you just add a single tag to the page. This simple process is described in the next section. The rest of the document is devoted to advanced issues and options.In short, if your page works in the Google Chrome browser, it'll work in GCF. Making Your Pages Work With Google Chrome FrameMaking your pages work with GCF is easy. Just add this tag to the top of the page:
For many sites, adding a tag to every page may be cumbersome, so GCF also supports detection through an HTTP header with the same name and value:
You may recognize the X-UA-Compatible flag as the same mechanism introduced with IE 8 for controlling the rendering engine that IE uses for a particular page. In cases where GCF is not installed, the values can be combined to control IE's rendering behavior:
Note that the value for the "IE" parameter must be provided first. Also, please note that no matter where in the order you list the value "chrome=1", GCF will render the page if it is installed. That is to say, the switch to render the page in GCF always takes the highest priority. To deploy this header site-wide for a site served with Apache, ensure that mod_headers and mod_setenvif are enabled and add the following to your httpd.conf (or appropriate configuration file):
For IIS 7.0 and greater, you can set the header in a web.config file with similar syntax:
GCF supports both the meta tag and HTTP header methods of triggering rendering interchangeably, allowing you to choose whichever approach is best for your site. Note also that GCF is best effort, meaning that if you specify the meta tag or header and GCF isn't installed, the page will be rendered in MSIE as normal. Detecting Google Chrome Frame and Prompting to InstallGCF reports that it is available by extending the host's User-Agent header with the stringchromeframe. You can use server-side detection to look for this token and determine whether GCF can be used for a page. If GCF is present, you can insert the required meta tag; if not, you can redirect users to a page that explains how to install GCF.As an alternative to server-side sniffing, you can use the CFInstall.js script to detect GCF and prompt users to install the plug-in without restarting their browsers. Using the script is straightforward:<html> body tag. In browsers other than Internet Explorer, the call to check() is a no-op. Note that you can't make a local copy of the JavaScript library and use it with a file:// URL - that won't work.In Internet Explorer, check() determines if Chrome Frame is installed. If not, the user is prompted to install it.You can choose how you want the user to be prompted. By default, check() injects an iframe at the top of the page. This iframe will navigate to a "Please install Google Chrome Frame" page hosted by Google. The overlay mode specified in the example ensures that this UI is displayed over other page content in a modal way and gives the user controls to disable the prompt for the site (noted for the future in a cookie).Once the user prompt is displayed, CFInstall examines the environment periodically to determine if the plug-in has finished installing. If it has, the browser is redirected to the destination URL. If no destination is provided, the current page is simply refreshed when GCF is detected. If the page was served with either the meta tag or HTTP header, the refreshed page will then render in GCF and the subsequent call to check() will not trigger the prompt.CFInstall.check() OptionsTheCFInstall.check method has many more options. You can specify:
CFInstall ExamplesUsing the node parameter with an inline prompt to place the prompt iframe in the page and using CSS to style the iframe, reloads the current page when install finishes:
Note the use of the IE-specific conditional comment syntax. This syntax prevents the code inside it from being visible to non-IE browsers. This avoids fetching the CFInstall script and running the checks on browsers that don't need them, speeding up your pages. Notably, if this page is served with the GCF meta tag or header and the page renders using GCF, the conditional comments will also be ignored, meaning that it's safe to wrap CFInstall-specific code in conditional comments Debugging ToolsYou can use the Web Inspector in GCF just as you would in the Google Chrome browser. To use it, right-click and choose "Inspect Element". Logging is available via theconsole.log method, and you can set breakpoints and inspect network activity.Testing Your SitesTo make your pages work with GCF, you should use the method of inserting ameta tag, as described earlier. There are other ways of invoking GCF. These techniques are useful for testing but are turned off by default. GCF provides a fast testing and prototyping shortcut that's especially useful when you can't modify the page you want to test. To use this method, just navigate to the URL prepended with "gcf:". Note that this prefix is in addition to any other URL scheme. For example, to see Gmail in GCF, go to Internet Explorer and navigate to:gcf:http://gmail.com gcf: and http: prefixes. To enable this testing-only feature, open regedit.exe and add a DWORD value AllowUnsafeURLs=1 under HKCU\Software\Google\ChromeFrame. By default only gcf:about:blank and gcf:about:version are allowed.In addition to the above, you can use the Windows Registry to force a URL to be loaded in GCF or make all URLs load in GCF by default. Chrome Frame as a default rendererVersion 7.0 onwards - Current Stable, Beta and Dev channels: You can use the Windows Registry or better yet Group Policy to force a URL to be loaded in GCF or make all URLs load in GCF by default. GCF supports two lists for this purpose and a flag to switch between which one is active. The flag is named IsDefaultRenderer, a REG_DWORD type value, and can be set to either 0 or 1: HKCU When GCF is the default renderer, Internet Explorer will send Chrome's User Agent string (except in cases where a URL is configured to load in IE, see below). This will make it appear like the request is coming from Chrome and it's not necessary for a site to include a meta tag. Depending on the setting of this value, GCF supports a list of exceptions. If IsDefaultRenderer is set to 0, this list (RenderInGcfUrls) contains patterns of URLs that should be rendered in GCF. Note that the URLs are registry values (and not sub-keys): HKCU If IsDefaultRenderer is set to 1, the other list (this time RenderInHostUrls) contains patterns of URLs that should be rendered in the host browser and not GCF. Again, note that the URLs are registry values (and not sub-keys): HKCU Before Version 7.0: You can use the Windows Registry to force a URL to be loaded in GCF. To achieve this, add an entry with a pattern or full URL for the pages/websites that you want to always be rendered in GCF. For example: HKCU DWORD value UseChromeNetworking=0 under HKCU\Software\Google\ChromeFrame. Chrome Frame as a closed containerGCF sends all top level navigation to Internet Explorer. This is to allow content to load other links in the host browser. This feature can be turned off by adding a Troubleshooting installation issuesIf Google Chrome Frame installation is failing, it's possible to collect an install log using MSI installer available to download at http://www.google.com/chromeframe/eula.html?msi=true. After downloading this: 1) Uninstall Chrome Frame if it is there in 'Add Remove Programs'. 2) Re-install using the MSI, by running this command from a command prompt: "msiexec.exe /i GoogleChromeframeStandaloneEnterprise.msi /l*v install.log" . The /l*v parameter will cause a detailed installer log to be generated. Inspect the generated install.log file for install failures. 3) After installing, you should have a file called chrome_frame_installer.log in your temp directory (you can get to it by doing Start -> Run and then typing %TEMP% in the box that appears). If install.log does not have any significant errors, look for failures in chrome_frame_installer.log. Please browse Google Chrome Frame user forums on further help in understanding install errors or post a new question there. |

