views:

1361

answers:

4

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.

+6  A: 

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
Welbog
Thanks Welbog. That will be the ideal scenario, also the scenario that will involve most amount of hours. Since the website menu was done with a plugin for .NET purchased in 2006, and no one is around to support it, is very unlikely that will happen. I will keep it in mind either way.
Geo
@Geo: Sounds to me like you got ripped off in 2006.
Welbog
A: 

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.

ScottE
A: 

Have you tried IE=7?

<meta http-equiv="X-UA-Compatible" content="IE=7" />
Olly Hodgson
Using that will force even a quirks page into IE7 Strict mode. That's almost never desirable, and IE supporting it was basically a mistake.Prefer IE=EmulateIE7 in almost all cases.
EricLaw -MSFT-
A: 

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)

EricLaw -MSFT-