<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
但不生效。 如何在客户端3以编程方式强制文档模式IE = 11 / IE = Edge?
答案 0 :(得分:1)
你有.htaccess文件吗? 我总是使用htaccess解决方案。
不是我的答案,如果你可以使用htaccess。 请参阅:Force IE8 *not* to use Compatibility View
anwser位于此行之下,来自该帖子
您还可以使用以下代码通过config或.htaccess文件在Apache中设置X-UA-Compatible标头。归功于html5boilerplate.com
# ----------------------------------------------------------------------
# Better website experience for IE users
# ----------------------------------------------------------------------
# Force the latest IE version, in various cases when it may fall back to IE7 mode
# github.com/rails/rails/commit/123eb25#commitcomment-118920
# Use ChromeFrame if it's installed for a better experience for the poor IE folk
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
BrowserMatch MSIE ie
Header set X-UA-Compatible "IE=Edge,chrome=1" env=ie
</IfModule>
</IfModule>
<IfModule mod_headers.c>
#
# Because X-UA-Compatible isn't sent to non-IE (to save header bytes), we need to inform proxies that content changes based on UA
#
Header append Vary User-Agent
# Cache control is set only if mod_headers is enabled, so that's unncessary to declare
</IfModule>
答案 1 :(得分:0)
您可以尝试使用以下元标记之一:
<meta http-equiv="x-ua-compatible" content="IE=EmulateIE9" >
<meta http-equiv="x-ua-compatible" content="IE=EmulateIE8" >
<meta http-equiv="x-ua-compatible" content="IE=EmulateIE7" >
和/或
<meta http-equiv="x-ua-compatible" content="IE=9" >
<meta http-equiv="x-ua-compatible" content="IE=8" >
<meta http-equiv="x-ua-compatible" content="IE=7" >
或者查看此MSDN article
答案 2 :(得分:0)
您的doctype很可能不正确。 一旦修复/添加它,它应该默认采用最新的
答案 3 :(得分:0)
使用类似的东西,即在头部外部使用元标记,然后在doctype下面使用: -
<!DOCTYPE html>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@HttpContext.Current.Cache["application_title"].ToString()</title>
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<meta name="viewport" content="width=device-width" />
</head>
<body>
...
</body>
</html>