How do I get IE9 to use standards compliant mode when developing on localhost?

会有一股神秘感。 提交于 2019-11-30 17:27:45

Try adding this:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

At the top of your page. I'm not sure if that will work locally if the other you tried didn't... but it's worth a go.

jorritvdven

Use <!DOCTYPE html> and add
<meta http-equiv="X-UA-Compatible" content="IE=9"> to the <head> section of your HTML page. It will force Internet Explorer to use IE standards mode.

I had this same problem. I had the HTML5 doctype on my aspx file, but it still rendered in IE7 mode. I fixed it without setting HTML4.01 Strict, and without meta http-equiv.

My problem was that I had an ASP tag, then the doctype in a separate line. IE9 wants the doctype to be on line 1 and nowhere else.

So if you have this:

<%
' some asp code
%>
<!DOCTYPE html>
<!-- rest of file -->

Consider changing it to this:

<%
' some asp code
%><!DOCTYPE html>
<!-- rest of file -->

This worked for me even with @Import statements before the initial asp block:

<%@ Import Namespace="System.Text.RegularExpressions" %>
<%
' some asp code
%><!DOCTYPE html>
<!-- rest of file -->

See the "IE Windows special: the xml prolog" section in this document:

http://www.quirksmode.org/css/quirksmode.html

Anything before the DOCTYPE will cause it to switch to Quirks mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!