demosthenes.info

A blog by Dudley Storey on , , , , , , and anything else that strikes his fancy.

featured articles

popular favourites

Applying ChromeFrame

ChromeFrame installer windowChromeFrame is an Internet Explorer plugin that essentially “zombifies” the browser: installing a plugin (which does not require an administrator name or password) that replaces IE’s own rendering engine, transforming the browser into “Chrome with an IE face”. In my opinion ChromeFrame remains the best and most complete way of bringing IE 6 – 9 “up to speed” with current web standards. (Popular alternatives take the form of JavaScript “shims” such as Modernizer, requiring far more work).

Indicating that you want Internet Explorer users who visit your site with ChromeFrame already installed to use the Chrome component is easy: it’s just a meta tag in the <head> section of your document:

  1. <meta http-equiv="X-UA-Compatible" content="chrome=1" />

If you want to have ChromeFrame render the page only if the version of IE is 8 or lower, the meta tag becomes:

  1. <meta http-equiv="X-UA-Compatible" content="chrome=IE8" />

Prompting the user to install ChromeFrame is a little trickier, but not difficult. First, you must link to the following script, again in the <head>:

  1. <script type="text/javascript"
  2. src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js">
  3. </script>

Finally, you need to check if ChromeFrame is installed, and if not, prompt the user to do so. You’ll probably want to delay this until IE has presented the page to the best of its ability, so under the script above, write:

  1. <script>
  2. window.onload=function(){
  3. CFInstall.check({ mode:"overlay", destination:"http://www.domain.com" });
  4. // where the user will be sent after installation
  5. } </script>

If you’re using JQuery instead:

  1. <script>
  2. $(document).ready(function() {
  3. CFInstall.check({ mode:"overlay",
  4. destination:"http://www.demosthenes.info" });
  5. })
  6. </script>

The screen that is generated by JavaScript prompting the user to install ChromeFrame has some CSS hooks. If you want to customize the appearance of the window, add the following classes and declarations to your stylesheet:

  1. .chromeFrameOverlayContent { }
  2. .chromeFrameOverlayContent iframe { }
  3. .chromeFrameOverlayCloseBar { }
  4. .chromeFrameOverlayUnderlay { }

If they don't have install privileges (i.e. in a corporate office with an overzealous I.T. team), will this essentially fail?

posted by Tony Downey

Dudley StoreyNope! ChromeFrame has a single-user install that will work without any username or password required. I've updated the article to reflect this, and placed ChromeFrame on this site so you can see how it works in IE.

posted by Dudley Storey

web developer guide

featured comment

by JoelB in Goodbye, JQuery Validation: HTML5 Form Errors With CSS3

what i'm reading

A Storm of Swords: A Song of Ice and Fire: Book Three
A Storm of Swords: A Song of Ice and Fire: Book Three

what i'm watching

Californication: The Third Season
Californication: The Third Season

what i'm playing

Mass Effect 3 Collector's Edition
Mass Effect 3 Collector's Edition

what i'm hearing

Dub FX
Dub FX

blogs

podcasts

no ads ever

This blog is free of advertising, and always will be.

creative commons licensed

The content of this blog is free to use in whatever way you wish under the Creative Commons license.