Html 在 Intranet 中强制使用“Internet Explorer 8”浏览器模式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2742853/
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
Force "Internet Explorer 8" browser mode in intranet
提问by Dennis C
There are "Internet Explorer 8", "Internet Explorer 8 Compatibility Mode", and IE7 mode in IE8.
IE8中有“Internet Explorer 8”、“Internet Explorer 8兼容模式”和IE7模式。
However, the default setting in IE make all intranet website use "IE8 Compatibility Mode" even I have setted doctype, the meta tag, http header as suggested to force it into IE8 mode.
但是,IE 中的默认设置使所有内网网站都使用“IE8 兼容模式”,即使我已经按照建议设置了 doctype、元标记、http 标头以强制其进入 IE8 模式。
I have
我有
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
and
和
<meta http-equiv="X-UA-Compatible" content="IE=8" >
<meta http-equiv="X-UA-Compatible" content="IE=8" >
But it still goes into "IE8 Compatibility Mode", without any changes in IE setting.
但它仍然进入“IE8 兼容模式”,IE 设置没有任何变化。
How to force it into pure "IE8" mode, without change any browser's setting?
如何强制进入纯“IE8”模式,而不更改任何浏览器的设置?
PS. I am not talking "document mode" here.
附注。我不是在这里谈论“文档模式”。
采纳答案by Dennis C
Seem that MSFT has not consider a large intranet environment that we have many different web application running inside.
似乎 MSFT 没有考虑到我们有许多不同的 Web 应用程序在其中运行的大型 Intranet 环境。
There is no way to bypass the IE8 setting, according to somewhere I read on MSDN forum.
根据我在 MSDN 论坛上读到的某处,没有办法绕过 IE8 设置。
So, I will have to beg my system administrators to put some new group policies to change "Compatibility View" setting and the value and prevent user change the value, until MSFT discover this bug and fix it.
因此,我将不得不恳求我的系统管理员设置一些新的组策略来更改“兼容性视图”设置和值并阻止用户更改值,直到 MSFT 发现此错误并修复它。
From an MSDN blog post(emphasis theirs): "Browser Mode is chosen before IE requests web content. This means that sites cannot choose a Browser Mode."
来自MSDN 博客文章(强调他们的):“在 IE 请求 Web 内容之前选择浏览器模式。这意味着站点不能选择浏览器模式。”
回答by Andras Csehi
It is possible to override the compatibility mode in intranet. Just add the below code to the web.config. Worked for me with IE9.
可以覆盖 Intranet 中的兼容模式。只需将以下代码添加到 web.config。使用 IE9 为我工作。
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=edge" />
</customHeaders>
</httpProtocol>
回答by Codex73
You'll have to make some adjustments to IE.
您必须对 IE 进行一些调整。
Here they are.....
他们来了.....
In Internet Options / Local Intranet / Sites
在 Internet 选项/本地 Intranet/站点中
Under : Local Intranet inside Sites, uncheck "Automatically detect intranet network".
在:站点内的本地 Intranet 下,取消选中“自动检测 Intranet 网络”。
Then select only "Include all network paths (UNCs)
然后只选择“包括所有网络路径(UNC)
See attached screenshots
见附件截图
回答by upshake
I found the answers here hard to follow, so here's the important information in a nutshell:
我发现这里的答案很难理解,所以简而言之,这里是重要的信息:
If your intranet uses default settings for IE, IE7 Standards Mode is enforced for intranet sites regardless of any website settings.
如果您的 Intranet 使用 IE 的默认设置,则无论任何网站设置如何,都会对 Intranet 站点强制执行 IE7 标准模式。
From this:
从这个:
Compatibility View and the Enterprise
A large number of line-of-business websites are Internet Explorer 7 capable today. In order to preserve compatibility, Internet Explorer 8 ships with smart defaults based on zone evaluation. In the default state, all sites on the public internet display in Internet Explorer 8 Standards mode (Compatibility View off) and all intranet websites display in Internet Explorer 7 Standards mode(Compatibility View on).
Let's look at some examples. If you navigate to sites on your local intranet like http://myPortaland http://sharepoint/sites/mySite, Internet Explorer 8 identifies itself with a User Agent string of ‘7', Version Vector of ‘7', and displays webpages that trigger standards mode in Internet Explorer 7 Standards mode. This combination allows webpages that worked correctly in Internet Explorer 7 to continue to do so in IE8.
兼容性视图和企业
今天,大量的行业网站都支持 Internet Explorer 7。为了保持兼容性,Internet Explorer 8 附带了基于区域评估的智能默认值。在默认状态下,公共 Internet 上的所有站点都以 Internet Explorer 8 标准模式(关闭兼容性视图)显示,所有 Intranet 网站以 Internet Explorer 7 标准模式(打开兼容性视图)显示。
让我们看一些例子。如果您导航到本地 Intranet 上的站点(如http://myPortal和 http://sharepoint/sites/mySite ), Internet Explorer 8 会使用用户代理字符串 '7'、版本向量 '7' 来标识自己,并显示在 Internet Explorer 7 标准模式下触发标准模式的网页。这种组合允许在 Internet Explorer 7 中正常工作的网页在 IE8 中继续这样做。
回答by Craig A
To override the Compatibility View settings for intranet or all websites you need to make IE8 emulate itself.
要覆盖 Intranet 或所有网站的兼容性视图设置,您需要让 IE8 模拟自己。
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
回答by David Kolar
Set a custom HTTP header instead of using the <meta...
in the <head>
section. These are supposed to be equivalent, but I have seen that an X-UA-Compatible
HTTP header from the server will override IE 8's "Display intranet sites in Compatibility View" setting, where the <meta...
element would not.
设置而不是使用自定义HTTP标头<meta...
的<head>
部分。这些应该是等效的,但我已经看到X-UA-Compatible
来自服务器的HTTP 标头将覆盖 IE 8 的“在兼容性视图中显示 Intranet 站点”设置,而<meta...
元素不会。
回答by Francisco Goldenstein
If you are using .NET, I have the answer for you:
如果您使用 .NET,我为您提供答案:
HTML:
HTML:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8" >
Web.Config:
网络配置:
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=8" />
</customHeaders>
</httpProtocol>
回答by BrunoSalvino
Read somewhere that the DOCTYPE declaration must be the very first line. No comments of any kind, nor empty lines.
在某处读到 DOCTYPE 声明必须是第一行。没有任何形式的评论,也没有空行。
In combination with setting the HTTP Response Headers, this worked for me. Browser Mode
went from "IE9 Compatibility Mode" to just "IE9 Mode".
结合设置 HTTP 响应标头,这对我有用。Browser Mode
从“IE9 兼容模式”变成了“IE9 模式”。
回答by Deborah
In order for the META declaration to work, the doctype has to be the simplified version:
为了使 META 声明起作用,文档类型必须是简化版本:
<!DOCTYPE html>
Not the longer statement in Dennis' question.
不是丹尼斯问题中更长的陈述。
回答by Yurok
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation IntranetCompatibilityMode 1-->0
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation IntranetCompatibilityMode 1-->0