IE9将我的页面以IE7文档模式和<!DOCTYPE html>被注释掉 [英] IE9 throws my page in IE7 document mode and <!DOCTYPE html> gets commented out

查看:385
本文介绍了IE9将我的页面以IE7文档模式和<!DOCTYPE html>被注释掉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网页有以下doctype

 <!DOCTYPE html& 

上面的行是我的HTML页面的第一行。
这些行之前没有额外的空格或注释。
仍然是IE7文档模式,并且<!DOCTYPE html>
被注释掉当我使用开发工具检查html页面。 / p>

我知道我可以通过添加以下元标记强制某个文档模式

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

但我不应该使用这个,我应该去工具和更改兼容性查看设置(工具 - >兼容性视图设置)。我还使用HTML5验证程序检查文档是否是有效的HTML5文档。



我搜索的一些解决方案是CSS这个问题即。使用Type 1字体(Helevetica)的Beacuse。我检查了我的CSS,无处我们使用这种字体。



基本上,我需要知道是什么原因导致这种不寻常的行为。
这是一些css或javascript是造成这种情况。



编辑:如提到的一个意见,我试图加载一个简单的html页面如下



 <!DOCTYPE html> 
< html>
< head>

< title> Hello Wrold< / title>
< / head>
< body>
< div> hello world !!< / div>
< / body>
< / html>

它的行为方式相同。在IE7文档模式下加载页面。

解决方案

检查您的html文件,确保没有BOM(字节顺序标记)文档的开头。这可能会导致一些浏览器的问题。为了检查,使用像Adobe Dreamweaver或Notepad ++。
在记事本中以ANSI模式打开文件,并检查是否有字符,删除它们并保存为无bom的UTF-8(在记事本++中保存时的选项)


My webpage has the following doctype

<!DOCTYPE html>

The above line is the very first line on my HTML page. These are no extra spaces or comments before this line. Still the page goes in IE7 document mode and <!DOCTYPE html> gets commented out when i check the html page using developer tools.

I know that I can force a certain document mode by including the following meta tag

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

But I am not supposed to use this, niether I am supposed to go to tools and change the compatibility view settings (Tools -> Compatibility view settings).I have also checked whether the document is valid HTML5 document using a HTML5 validator.

Some solutions I searched were of CSS causing this problem ie. beacuse of using Type 1 font (Helevetica). I checked my css and nowhere we are using this font.

Basically I need to know what are the reasons that is causing this unusual behaviour. Is it some css or javascript that is causing this.

EDIT : as mentioned in one of the comments I tried loading a simple html page as follows

<!DOCTYPE html>
  <html>
   <head>

   <title>Hello Wrold</title>
   </head>
   <body>
      <div>hello world!!</div>
   </body>
  </html>

It is behaving the same way. Page loads in IE7 document mode.

解决方案

Check your html file and make sure there is no BOM (Byte Order Mark) at the beginning of the document. This can cause problems in some browsers. In order to check, use something like Adobe Dreamweaver or Notepad++. Open file in ANSI mode in notepad and check if there are characters before, delete them and save as UTF-8 without bom (option when saving in notepad++)

这篇关于IE9将我的页面以IE7文档模式和&lt;!DOCTYPE html&gt;被注释掉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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