Geo
Geo

Reputation: 8761

What to do if the head tag to make IE8 Emulate IE7 does not work?

Following the advice of the following post, I added the following code to one of my client's websites in .NET.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> 

For some reason the website is still not displaying the menus correctly. If I go into the IE8 menus and add the web URL to always show in Compatibility mode then the site starts working correctly. How should I proceed?

NOTE: This is an old website constructed in 2006-2007. This is not a website under current development.

Upvotes: 2

Views: 3174

Answers (4)

EricLaw
EricLaw

Reputation: 57075

If the Emulation tag isn't working, there's a very good chance that the page is sending back different data based on the User-Agent string.

The user-agent string sends "7.0" when a site is in the compatibility list, but sends "8.0" when the site uses the META tag (because the request has already been sent by the time the server asks for IE7 mode).

You can use Fiddler (www.fiddler2.com) to troubleshoot this, or try the User-Agent picker addon (http://www.enhanceie.com/ietoys/uapick.asp)

Upvotes: 0

Olly Hodgson
Olly Hodgson

Reputation: 15775

Have you tried IE=7?

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

Upvotes: 0

Welbog
Welbog

Reputation: 60398

How should I proceed?

Figure out what's preventing the menu from working in IE8 and fix it. It's better to fix the root cause of a problem than to treat its symptoms. The root problem is the menu being broken. You intend to just cover it up by having IE display it as if it were another browser. Fix the root cause and this compatibility thing won't be a concern.

EDIT:

Anyway, according to this article, the IE=EmulateIE7 meta tag might interpret the page as standards or quirks, depending on the doctype of the page. Since your doctype is transitional it might be using a mode you don't intend. What I would do is try the other modes outlined on that page:

Quirks*            IE=5          IE 5.5 (Quirks) rendering mode
IE 7 Standards*    IE=7          IE 7 standards rendering mode
IE 7 Emulation     IE=EmulateIE7 IE 7 standards or Quirks rendering, depending on DOCTYPE
IE 8 Standards*    IE=8          IE 8 standards rendering mode
IE 8 Emulation     IE=EmulateIE8 IE 8 standards or Quirks rendering, depending on DOCTYPE
Latest Mode*       IE=edge       Always use the latest standards rendering mode

Upvotes: 6

ScottE
ScottE

Reputation: 21630

Have you tried adding the http header site-wide in IIS?

X-UA-Compatible: IE=EmulateIE7

http://blogs.msdn.com/ie/archive/2008/06/10/introducing-ie-emulateie7.aspx lists some links on how to do that on different versions of IIS.

However, like Welbog said above, you should instead make this work in IE8. That header was introduced to make it easier to migrate existings sites to IE8, not for new ones in development.

Upvotes: 0

Related Questions