Html 如何避免ie8兼容按钮?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/637039/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 23:25:24  来源:igfitidea点击:

How to avoid ie8 compatibility button?

htmlinternet-explorer-8

提问by Ramesh

In IE8, the Microsoft introduced a new mode called compatibility mode which would render the page like IE7.

在 IE8 中,微软引入了一种称为兼容模式的新模式,它可以像 IE7 一样呈现页面。

You can see this button next to address bar in stackoverflow.com. But when you access google.com / live.com, you would not see the compatibility mode button. How do we make sure the pages don't show this button the user?

您可以在 stackoverflow.com 的地址栏旁边看到此按钮。但是当您访问 google.com/live.com 时,您将看不到兼容模式按钮。我们如何确保页面不会向用户显示此按钮?

回答by Guffa

Short answer:

简短的回答:

Put this in your head tag to tell the browser that your page works in IE 8:

把它放在你的 head 标签中,告诉浏览器你的页面在 IE 8 中工作:

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

Also as per Jon Hadleys comment, to ensure the latest (not just IE8) rendering engine is used, you could use the following:

同样根据 Jon Hadleys 的评论,为确保使用最新的(不仅仅是 IE8)渲染引擎,您可以使用以下内容:

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

回答by Matt Hamilton

From here:

这里

Sometimes the Compatibility View button isn't displayed.

The button is located on the address bar next to the ‘stop' and ‘refresh' buttons. There are a few cases where there's no action for a user take and, thus, the Compatibility View button will not show:

If you're viewing an internal-to-Internet Explorer page (such as about:InPrivate)

If you're viewing a page that has declared it's "ready" for Internet Explorer 8 through use of the versioning tag / HTTP header (it doesn't matter if this tag triggers Quirks, IE7 Standards, or IE8 Standards, the button won't be displayed)

If you're viewing an intranet page and you have the ‘Display intranet sites in Compatibility View' checkbox selected If you're viewing any webpage and you have the ‘Display all websites in Compatibility View' checkbox selected

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

If you've toggled either the ‘Document Mode' or ‘Browser Mode' settings via the Developer Toolbar

有时不显示兼容性视图按钮。

该按钮位于地址栏中“停止”和“刷新”按钮旁边。在某些情况下,用户无需执行任何操作,因此“兼容性视图”按钮不会显示:

如果您正在查看 Internet Explorer 内部页面(例如 about:InPrivate)

如果您正在查看已通过使用版本控制标记/HTTP 标头声明其已“准备好”用于 Internet Explorer 8 的页面(此标记是否触发 Quirks、IE7 标准或 IE8 标准无关紧要,按钮将不会出现)不显示)

如果您正在查看 Intranet 页面并且选中了“在兼容性视图中显示 Intranet 站点”复选框 如果您正在查看任何网页并且选中了“在兼容性视图中显示所有网站”复选框

如果您正在查看包含在 Microsoft 提供的兼容性视图更新列表中的网页,并且您选中了“包含来自 Microsoft 的更新的网站列表”复选框

如果您通过开发人员工具栏切换了“文档模式”或“浏览器模式”设置

So you're probably after the versioning tag / HTTP header which is described in more details in that blog post and over here.

因此,您可能在关注版本控制标记/HTTP 标头,该博客文章和此处有更详细的描述。

回答by Eli Sand

If the "Display intranet sites in Compatibility View" or "Display all websites in Compatibility View" settings (found under Tools -> Compatibility View Settings) are enabled (as they relate to the website being viewed), then no matter what you have in the HTML of the document, the page will alwaysbe put in to some form of compatibility view.

如果启用了“在兼容性视图中显示 Intranet 站点”或“在兼容性视图中显示所有网站”设置(在工具 -> 兼容性视图设置下找到)(因为它们与正在查看的网站相关),那么无论您在文档的 HTML,页面将始终置于某种形式的兼容性视图中。

This means that, even with in the document, you will still notice that the page is put in to compatibility view, and nothing you can do except disabling those settings will disable it, unfortunately.

这意味着,即使在文档中,您仍然会注意到该页面被置于兼容性视图中,不幸的是,除了禁用这些设置之外,您无法做任何事情都会禁用它。

回答by mvark

As per this comprehensive MSDN article on Compatibility View, the following list describes different ways that enable Compatibility View:

根据这篇关于兼容性视图的综合MSDN 文章,以下列表描述了启用兼容性视图的不同方法:

  • You click the Compatibility View button in the Address bar when viewing a webpage. When displayed, this button appears to the left of the Refresh button and contains an image of a broken piece of paper. This enables Compatibility View for all documents in the domain of the website being viewed.
  • The "Display all websites in Compatibility Mode setting" in the Compatibility View Settings is enabled.
  • The "Automatically recover from page layout errors with Compatibility View" setting is enabled and a webpage stops responding or crashes the browser. When this happens, Internet Explorer opens the page in Compatibility View after recovering from the problem.
  • Group policies that identify sites to be opened in Compatibility View are enabled by the administrator of your computer.
  • You have used the F12 developer tools to change the browser mode to identify Internet Explorer as an earlier version of the browser.
  • The Compatibility View List is enabled, which defines a list of websites that are automatically displayed in Compatibility View.
  • 查看网页时,单击地址栏中的兼容性视图按钮。显示时,此按钮出现在“刷新”按钮的左侧,并包含一张破损纸的图像。这将为正在查看的网站域中的所有文档启用兼容性视图。
  • 启用了兼容性视图设置中的“以兼容模式设置显示所有网站”。
  • “使用兼容性视图自动从页面布局错误中恢复”设置已启用,网页停止响应或使浏览器崩溃。发生这种情况时,Internet Explorer 在从问题中恢复后在兼容性视图中打开页面。
  • 标识要在兼容性视图中打开的站点的组策略由您的计算机管理员启用。
  • 您已使用 F12 开发人员工具更改浏览器模式,以将 Internet Explorer 标识为浏览器的早期版本。
  • 兼容性视图列表已启用,它定义了在兼容性视图中自动显示的网站列表。

To avoid/disable/override Compatibility View, you'll have to do the reverse of the actions suggested above.

为了避免/禁用/覆盖兼容性视图,您必须执行上述建议的相反操作。

The Compatibility View list is an XML file maintained by Microsoft.

兼容性视图列表是由 Microsoft 维护的 XML 文件。

To remove your site from the Compatibility View List (or to dispute the removal of your site from the list), have the overall site owner verify that the domain site appears in the Compatibility View List. If it does, send an e-mail to [email protected] that contains the following information:

Owner name Corporate title Company name Street address Email address Telephone number Website address

Microsoft will review the provided information and remove your site from the Compatibility View List at the next scheduled update.

要从兼容性视图列表中删除您的站点(或对从列表中删除您的站点提出异议),请让整个站点所有者验证域站点是否出现在兼容性视图列表中。如果是,请向 [email protected] 发送一封包含以下信息的电子邮件:

所有者姓名 公司名称 公司名称 街道地址 电子邮件地址 电话号码 网站地址

Microsoft 将审核提供的信息,并在下一次计划更新时从兼容性视图列表中删除您的站点。

回答by Shadaksharayya H A

Below link was working fine in IE and it was showing menu bar properly http://line25.com/wp-content/uploads/2012/css-menu/demo/index.html

下面的链接在 IE 中工作正常,它正确显示菜单栏 http://line25.com/wp-content/uploads/2012/css-menu/demo/index.html

But same content hosted on intranet, all links were displayed one below other instead of menu bar. Compatibility view button was not shown in address bar.

但是相同的内容托管在 Intranet 上,所有链接都显示在一个下方,而不是菜单栏。地址栏中未显示兼容性视图按钮。

After below change, the menu bar got displayed correctly and compatibility view button got displayed in address bar.

以下更改后,菜单栏显示正确,地址栏中显示兼容性视图按钮。

Tools->Compatibility view settings->Uncheck "Display intranet sites in compatibility view"

工具->兼容性视图设置->取消选中“在兼容性视图中显示内网站点”

Thanks a lot for this valuable input

非常感谢您的宝贵意见

回答by K0D4

I was having an issue with compatibility view, and it turned out some of my PHP files were being saved in UTF-8 character encoding, which I guess was confusing IE. The majority of the site files were saved in Codepage 1252.

我在兼容性视图方面遇到了问题,结果发现我的一些 PHP 文件以 UTF-8 字符编码保存,我猜这让 IE 感到困惑。大多数站点文件都保存在代码页 1252 中。

Now, I set all the files to save as "Western European (Windows) - Codepage 1252" and my display issues went away.

现在,我将所有文件设置为另存为“西欧 (Windows) - 代码页 1252”,我的显示问题就消失了。

The lesson here is, don't mix your character encodings.

这里的教训是,不要混合您的字符编码。