making bbPress (and WordPress) work better!

Turn on Chrome Frame for Internet Explorer in WordPress (and bbPress)

Google is promoting their Chrome “frame” enhancement for Internet Explorer users that allows people to stay with the IE interface but run the much faster and safer Chrome browser inside it.

However ChromeFrame has to be turned on for each website they visit.

To turn it on in WordPress and bbPress you should be able to add this single line as a mini-plugin, or in header.php or even in functions.php.

<?php if (strpos($_SERVER['HTTP_USER_AGENT'],"chromeframe")) {header("X-UA-Compatible: chrome=1");} ?>

Update: the above will not work, apparently Chrome needs it to be a META tag and not in the page headers 😦 – thanks Matt

If you want to just put it in header.php use this (before </head>)

if (strpos($_SERVER['HTTP_USER_AGENT'],"chromeframe")) {echo '<meta http-equiv="X-UA-Compatible" content="chrome=1" />'}

If you want it to be a real plugin, use this:

function chromeframe() {
if (strpos($_SERVER['HTTP_USER_AGENT'],"chromeframe")) {echo '<meta http-equiv="X-UA-Compatible" content="chrome=1" />';}

8 responses

  1. Just so you know, Chrome Frame doesn’t currently support triggering via a header like that, you can only activate it with the meta tag or sending the application/chrome mime type.

    September 25, 2009 at 2:14 am

  2. Wow, that’s not good. Must be a limitation of it running as a plugin in IE.

    Well a few more lines and running it as a formal WP/bbPress plugin will solve that but it’s unfortunate it needs the added complexity.

    Thanks for the “head’s up” !

    September 25, 2009 at 2:29 am

  3. Hi,

    This method you presented will be the way to handle things in the future, definitely.

    For now, the sure fire way to enable Chrome Frame support in WordPress is via a plugin:

    September 25, 2009 at 5:07 pm

  4. Why install a 10k plugin when one line in header.php will do?

    September 26, 2009 at 12:07 am

  5. Grated, ck. But the plugin also brings other features. Like the ability to prompt the user to install the Chrome Frame add-on.
    Plus, some less savvy people should never be put to manually edit the header of their blog theme. 😉

    September 26, 2009 at 3:51 am

  6. Users should not be nagged, ever.

    Teaching people, especially IE users to click on things that nag them, is VERY dangerous.

    We don’t exist to promote Google. Taking advantage of an existing plugin is fine but I’ll never shill for their product even if it’s free because that implies a responsibility to help the person if it screws up their browser somehow.

    They might never come back to your site if things go wrong.

    September 26, 2009 at 5:02 am

  7. Users are always nagged!
    From the WordPress comment form to Windows update to Apple update to linux update-manager.
    Because they’re lazy, that’s why.

    This is no longer about the plugin or Chrome Frame. Users must be nagged, otherwise they don’t care fast enough.

    That’s why Firefox has an auto-updater that prompts you about, well, updates. Which approach is better? Firefox’s update prompt or Google’s background updater that does its job without asking you anything? I digress.

    I agree that forcing a user to do something is bad, but letting them know of something that might help them out… that’s a one-time nag I can live with.

    September 26, 2009 at 5:09 am

  8. Light

    Dear _ck_:

    I’m in trouble please guide me.
    I’m using bbpress revolution theme, it’s working gud but when i go to the add new topic, then it’s coding looks disturb. hot tags and search bar leave their places and they merge in the side bar with adsense. please see it. and tell me what can i do.

    here are it’s screen shots


    Love you

    November 1, 2009 at 9:46 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s