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

前端 未结 4 781
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-03 23:01

According to MSDN, all I need to force standards compliant mode is to include the HTML 5 doctype:

http://msdn.microsoft.com/en-us/library/gg699338%28v=vs.85%29.aspx<

4条回答
  •  孤独总比滥情好
    2021-01-03 23:24

    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
    %>
    
    
    

    Consider changing it to this:

    <%
    ' some asp code
    %>
    
    

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

    <%@ Import Namespace="System.Text.RegularExpressions" %>
    <%
    ' some asp code
    %>
    
    

提交回复
热议问题