javascript IE 问题与 HTML5 headers.char utf-8 编码显示为错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14640175/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IE issues with HTML5 headers.char utf-8 encode is shown as error
提问by SREE ANI
I am trying to make my site working on IE 9. But from the beginning itself, it shows many errors.
我试图让我的网站在 IE 9 上工作。但从一开始,它就显示了许多错误。
HTML1114: Codepage iso-8859-1 from (HTTP header) overrides conflicting codepage utf-8 from (META tag) index.html
This is the error when I load in IE 9, but it's working fine in Firefox and Chrome. I am using HTML 5, so my header looks like below -
这是我在 IE 9 中加载时的错误,但它在 Firefox 和 Chrome 中运行良好。我使用的是 HTML 5,所以我的标题如下所示 -
<meta http-equiv='cache-control' content='0' >
<meta http-equiv='ETag' content='o2389r-98ur0-w3894tu-q894' />
<meta http-equiv='pragma' content='no-cache' />
<meta name="expires" content="never">
Due to these errors, I am stuck. And no jQuery or javascript works. Can't even log in. Please help me. And also, suggest me a debugger for tracking javascript.
由于这些错误,我被卡住了。并且没有 jQuery 或 javascript 工作。甚至无法登录。请帮助我。而且,建议我一个用于跟踪 javascript 的调试器。
回答by otakustay
This error shows up because you specified encoding inboth Content-Type HTTP Headerand <meta>
tag, and they specifies different codepage.
出现此错误是因为您在Content-Type HTTP Header和<meta>
tag 中指定了编码,并且它们指定了不同的代码页。
It's not an error, it's just a warning and I think it would not break your webpage. Mozilla just doesn't report such warnings but has the same behavior as IE9.
这不是错误,只是警告,我认为它不会破坏您的网页。Mozilla 只是不报告此类警告,但具有与 IE9 相同的行为。
Try to modify your Content-Type HTTP Headerto give a UTF-8 encoding would probably solve this problem.
尝试修改您的Content-Type HTTP 标头以提供 UTF-8 编码可能会解决此问题。
回答by iodonnet
I believe your server might be overriding your meta tags. This post might be helpful:
我相信您的服务器可能会覆盖您的元标记。这篇文章可能会有所帮助:
http://social.msdn.microsoft.com/forums/is/web/thread/2b7be95a-a90b-425f-b799-1b68a6d94f77
http://social.msdn.microsoft.com/forums/is/web/thread/2b7be95a-a90b-425f-b799-1b68a6d94f77
For javascript debugging if it's not a complex thing I use the command console.log...
对于javascript调试,如果它不是一件复杂的事情,我使用命令console.log ...