如何强制 Internet Explorer 在标准模式下呈现而不是在 Quirks 中呈现? [英] How do I force Internet Explorer to render in Standards Mode and NOT in Quirks?
问题描述
我正在编写一个在 IE7 标准模式和 IE8 标准模式下运行良好的前端.
I am coding a Frontend which works well in IE7 Standards Mode and IE8 Standards Mode.
当我启动 Internet Explorer 并加载页面时,IE7 和 IE8 都会直接进入 Quirks 模式.如何强制 IE7 和 IE8 始终以标准模式加载页面?
When I start up Internet Explorer and load the page both IE7 and IE8 go to Quirks Mode directly. How can I force both IE7 and IE8 to always load the page in Standards Mode?
到目前为止我没有添加任何特殊的元标记.
I have no special meta tags added so far.
谢谢你的帮助
我的文档类型和头部目前如下所示:
My doctype and head looks as follows at the moment:
<!DOCTYPE html>
<html lang="de">
<head>
<title>...</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="utf-8" />
<script src="js/html5.js"></script>
(...)
</head>
推荐答案
这是绝对确定的方法:
<!doctype html> <!-- html5 -->
<html lang="en"> <!-- lang="xx" is allowed, but NO xmlns="http://www.w3.org/1999/xhtml", lang:xml="", and so on -->
<head>
<meta http-equiv="x-ua-compatible" content="IE=Edge"/>
<!-- as the **very** first line just after head-->
..
</head>
原因:
每当 IE 遇到任何冲突时,它都会返回IE 7 标准模式",忽略 x-ua-compatible
.
Reason :
Whenever IE meets anything that conflicts, it turns back to "IE 7 standards mode", ignoring the x-ua-compatible
.
(我知道这是一个非常古老的问题的答案,但我自己也一直在努力解决这个问题,上面的方案是正确的答案.它一直有效,每次)
(I know this is an answer to a very old question, but I have struggled with this myself, and above scheme is the correct answer. It works all the way, everytime)
这篇关于如何强制 Internet Explorer 在标准模式下呈现而不是在 Quirks 中呈现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!