如何强制Internet Explorer在标准模式下呈现而不是在Quirks中呈现? [英] How do I force Internet Explorer to render in Standards Mode and NOT in Quirks?

本文介绍了如何强制Internet Explorer在标准模式下呈现而不是在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.

感谢您帮助我

编辑:我的doctype和head目前看起来如下:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆