Is it possible to add the following code to theme/system/html.tpl.php file on line 51?

<meta http-equiv="X-UA-Compatible" content="IE=edge">

This should fix the view in IE9 when the browser is set to IE7 or 8 for some reason.

Comments

markhalliwell’s picture

Title: IE Compatible » IE X-UA-Compatible
Version: 7.x-3.0 » 7.x-3.x-dev
Status: Active » Closed (won't fix)

Despite the seemingly simple "solution" of adding a <meta> tag to solve this, I know for a fact through personal experience that this does not always work, see http://stackoverflow.com/a/9338959/1226717. It also (currently) does not validate against HTML5 standards (even though HTML5 validation is still in experimental stages), see http://stackoverflow.com/a/6771584/1226717.

You could attempt to add this via the page header with drupal_add_http_header() in your sub-theme's template.php file. This is similar to patch that got into D8: #1203112: Add X-UA-Compatible HTTP header. However, this also may not work due to how D7 handles page caching (which sometimes affects HTTP request headers, especially when things like varnish are involved).

Instead what should really happen is that the web server itself (that the site is served from) should be modified to send this header for every request, see http://drupal.stackexchange.com/a/50280/5024.

My personal opinion (not really related to the technical merits above):
Despite IE's nobel intentions of solving the problem of ever evolving doctypes (http://alistapart.com/article/beyonddoctype), there is a trend that we're seeing every where on the web (especially with HTML5 sites):

Just set it to "edge"

This actually defeats the whole purpose of IE's "compatibility mode". It's meant to ensure that the page will render appropriately for a given doctype/browser version. If all we do is constantly say "just use the latest rendering engine", what is the point for IE to have a "compatibility mode" at all. It is very highly likely that it will eventually go away as no one will actually end up using it.

For this reason alone, I think it should be handled on a site by site basis where IE support is deemed "necessary" if you will. If more sites appeared "broken" instead of applying the "band-aid fix" of forcing the latest rendering engine all the time, IE would be forced to finally deal with it. Also, there were more logistical and practical reasons why other browsers didn't adopt this technique as well:

http://ejohn.org/blog/meta-madness/
http://robert.ocallahan.org/2008/01/http-equiv_22.html

I am closing this as "won't fix" for the many reasons stated above, however if there is sufficient evidence or more users deem this an actual requirement to be added, we can revisit this at a later time (but this is very, very unlikely).

micromegas’s picture

The reasons you mentioned for not using the meta tag are all valid. However, the end result is that the Bootstrap base theme doesn't work in IE in all cases. For example, if IE decides your site is an "intranet" site, then it will force the page into compatibility mode, most of the time with disastrous results.

You are correct that the metatag may not work in all cases, and is not a technically ideal solution, but if our goal is "greatest benefit for the greatest number of users", then it may be prudent to add it, especially when there is no negative effect in doing so. Many of the Bootstrap examples have the metatag, so this is a generally-accepted way of doing things.

Here's my story: A year ago, I evaluated this theme with IE on our corporate network... and it looked horrendous due to rendering in compatibility mode. At that time, I was a site builder, and I didn't know what an "x-ua-compatible' metatag was, or what the correct search terms were to type into google to find this issue. The result was that I installed a different, inferior theme, which worked out-of-the-box, and it was a loss for everyone.

Also, I'd like to point out that using drupal_add_http_header() didn't work for me in IE9, since the metatag needed to be printed as the fist element in the head tag, and the current html.tpl.php has a couple things ahead of it.

micromegas’s picture

Status: Closed (won't fix) » Active
markhalliwell’s picture

Status: Active » Closed (won't fix)

doesn't work in IE in all cases

Which is why I still believe this should be handled on a case by case basis. It is really a rather simple fix for a sub-theme to add this tag in a template override from the base-theme's html.tpl.php file if it's so desired. You have not presented any newer information here that warrants blanketing and abusing this tag out-of-the-box by this base-theme.

"greatest benefit for the greatest number of users"

IE doesn't even fall in to this statement to begin with, especially if you are counting its fragmented versions separately.

especially when there is no negative effect in doing so

There are negative consequences for doing this, as stated above (which even you even agreed were valid).

markhalliwell’s picture

Title: IE X-UA-Compatible » Improve IE support documentation
Component: Code » Documentation
Category: Feature request » Support request
Status: Closed (won't fix) » Active
Related issues: +#2466425: Update documentation

After discussing this with @neardark, he agrees that this should never really be a part of the base-theme.

I think the most we'd be willing to offer towards this goal is to provide "official" documentation on how to support these use cases.

We're in the process of already doing this for other aspects of the documentation, but I will leave this open so we don't forget about IE specifically.

markhalliwell’s picture

Priority: Normal » Minor

This should be part of the IE section in the documentation's FAQ:
http://drupal-bootstrap.org/api/bootstrap/docs%21FAQ.md/group/faq/7.x-3....

Patches are welcome

markhalliwell’s picture

Status: Active » Closed (fixed)

I'll say this is "fixed". Create a new issue and reference this one if someone wishes to update that verbiage with a patch.