问题描述:

I'm developing a website using Umbraco and I'd like to flick between IE8 and IE7 using the compatibility button, but it's hidden. It is an internal address but I've not had the problem with similar sites on the same server. (The only difference is this is using a 'non-standard' port 8080, I shouldn't think that would make a difference?)

I've checked the following blog post; Compatibility View Button Missing in IE8

Which states,

The Compatibility View button will be missing for the following

reasons,

  • If you’re viewing any webpage and you have the ‘Display all websites

    in Compatibility View’ checkbox selected in Tools > Compatibility View

    Settings.

  • If you’re viewing a webpage that is included on the

    Microsoft-supplied compatibility view updates list and you have the

    ‘Include updated website lists from Microsoft’ checkbox selected in

    Tools > Compatibility View Settings,

  • If you’re viewing an intranet page and you have the ‘Display intranet sites in

    Compatibility View’ checkbox selected in Tools > Compatibility View Settings.

  • If you’ve toggled either the ‘Document Mode’ or ‘Browser Mode’ settings

    via the Developer Toolbar.

  • If you’re viewing a page that has declared it’s “ready” for Internet Explorer 8.

My site/browser settings don't fall into any of these categories so I can only presume there's more factors involved.

I'm using the following DOCTYPE in all of my pages,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I can force IE to render using the latest version by including,

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

But this doesn't give me the functionality to switch browser modes via the button.

Any ideas?

网友答案:

this is to make html5 to work in IE8,9

<!--[if lt IE 9]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js" type="text/javascript"></script>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/ie7-squish.js" type="text/javascript"></script>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
<![endif]-->

Hope this will help

网友答案:

If you are indeed including this tag in your page

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

then that is why the button is missing. You've communicated to IE that the site is (supposedly) compatible with its standards rendering mode. Hence it will not display a button to the user for compatibility mode because that would (supposedly) allow the user to accidentally switch the rendering mode, potentially mangling the visual layout of your site.

Ironically, I've often had the opposite problem. The button frequently shows up when I don't want it to. The criteria for whether or not it shows up seems very finicky. Should you every want the opposite behavior (no button being present) I recommend making the above meta tag the first tag of your header.

相关阅读:
Top