我知道这是一个老问题,有很多解决方法。我已经应用了以下方法,但我的一些用户仍然会使用quirks模式。它也是唯一运行IE 8的用户。
<!doctype html>和
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">这似乎还不够,在IE8中页面仍然呈现在quirksmode中。
由于这是一个umbraco/c#站点,源代码中的第一行是空的。这是因为顶部的Master指令。你不能在它上面移动。请参见图片。

这是网站上的一些代码。
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!-- Consider adding an manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="sv">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<!-- Use the .htaccess and remove these lines to avoid edge case issues.
More info: h5bp.com/b/378 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">来源是这样的。
<%@ Master Language="C#" AutoEventWireup="true" %>
<!doctype html>
<%@ Import Namespace="System.Web.Configuration" %>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!-- Consider adding an manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="sv">"Master“在顶部创建空行。
安装Google Chrome框架可以解决这个问题,但由于citrix环境的原因,我们的一些用户没有安装插件的完全控制权。
发布于 2012-10-16 00:26:48
请查看Henri Sivonen的页面Activating Browser Modes with Doctype,其中还讨论了IE8/9特性以及(尽管页面名称)可能影响浏览器模式的doctype声明以外的其他因素。
发布于 2012-12-05 03:14:50
该页面在intranet上吗?我相信在这种情况下,IE8默认使用quirks模式。不过,您可以设置一个组策略来解决此问题。
https://stackoverflow.com/questions/12897473
复制相似问题