即使使用DOCTYPE设置,页面仍会在IE8上进入Quirks模式 [英] Page keeps entering Quirks mode on IE8 even with DOCTYPE set

查看:257
本文介绍了即使使用DOCTYPE设置,页面仍会在IE8上进入Quirks模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图加载我的网站在IE8,它保持回到怪异模式和显示页面都很搞笑。我可以通过开发者工具切换到IE8文档模式,这是很好,但没有回答为什么它会自己恢复为Quirks模式。



我设置了<!DOCTYPE html> 所以它不应该这样做。页面顶部包括由CMS生成的页面:

 (忽略此行,此处显示空行在源代码中)




<!DOCTYPE html PUBLIC - // W3C // DTD XHTML 1.0 Transitional // ENhttp: /www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<! - [if IE 7]> < html class =ie7 no-jslang =en> <![endif] - >
<! - [if lte IE 8]> < html class =ie8 no-jslang =en> <![endif] - >
<! - [if(gte IE 9)|!(IE)]>< < html class =not-ie no-jslang =en> <! - <![endif] - >
< head>
< meta charset =utf-8>
< meta http-equiv =X-UA-Compatiblecontent =IE = border,chrome = 1>
< meta name =viewportcontent =width = device-width,initial-scale = 1,maximum-scale = 1>

任何想法?谢谢!

解决方案

我相信IE默认为Quirks,除非你强制使用标准。我用这个在IE ...强制标准...

 <!DOCTYPE html> 

doctype必须与上述一致,才能强制标准工作p>

 < html> 
< head>

下面几行必须是head标记中的 first

 < meta http-equiv =X-UA-Compatiblecontent =IE = edge/> ; 
< meta http-equiv =X-UA-Compatiblecontent =IE = 9/>
< meta http-equiv =X-UA-Compatiblecontent =IE = 8/>

第一行强制理解edge的IE版本的标准 - 无论什么版本,上面的9应该理解这一行是指示它显示标准。



由于IE9不理解边缘,第二行强制IE9显示在标准。 p>

由于IE8不理解content =IE = 9,它会跳过这一点,并移动到下一行,它理解,并强制它显示在标准。



我用doctype之上的空格和硬回车测试了所有这些,他们工作正常,即使有空格和返回。



我认为你可以在IE8的IE8语句下面放置另一个语句,但我不想发布这个。


I'm trying to load my site in IE8 and it keeps reverting back to Quirks Mode and displays the page all funny. I can switch it to IE8 document mode via developer tools and it's fine, but doesn't answer why it keeps reverting to Quirks Mode by itself.

I have set <!DOCTYPE html> so it shouldn't be doing it. The top of the page includes this, as generated by the CMS:

(ignore this line, it's here to show the blank lines in the source code)




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--[if IE 7]>                  <html class="ie7 no-js" lang="en">     <![endif]-->
<!--[if lte IE 8]>              <html class="ie8 no-js" lang="en">     <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="not-ie no-js" lang="en">  <!--<![endif]-->
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

Any ideas? Thanks!

解决方案

I believe IE defaults to Quirks unless you force it to use standards. I use this to force standards in IE...

<!DOCTYPE html> 

The doctype must be exactly as above to force standards to work (so far so good).

<html>
<head>

The next lines must be the first in the head tag, or they are ignored.

<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />

The first line forces standards for IE versions that understand "edge" - no matter what version, any version above 9 should understand this line to be instructing it to display standards.

Since IE9 does not understand "edge", the second line forces IE9 to display in standards.

Since IE8 does not understand content="IE=9", it skips this and moves on to the next line, which it does understand, and which forces it to display in standards.

I tested all of these with spaces and hard returns above the doctype and they worked fine even with spaces and returns.

I think you can place another statement below the IE8 statement for IE7, but I don't want to swear to this.

这篇关于即使使用DOCTYPE设置,页面仍会在IE8上进入Quirks模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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