Why HTML1113: Document mode restart from IE9 Standards to Quirks

前端 未结 2 1002
旧巷少年郎
旧巷少年郎 2020-12-05 18:34

I open a webpage in IE9 - and all of a sudden the document mode switches to Quirks mode. The page itself is dead simple - no doctype, no meta tag, just a piece of (test purp

相关标签:
2条回答
  • 2020-12-05 19:03

    Have you tried explicitly setting compatibility in the HTML you generate?

    HTML5 doctype putting IE9 into quirks mode?

    <head>
      <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
      ..
    
    0 讨论(0)
  • 2020-12-05 19:13

    As no one jumps up to the occasion, I will answer the question myself.
    As paulsm4 indicated in comment to the question, it's the missing doctype which triggers quirks mode. See http://hsivonen.iki.fi/doctype/ for an excellent overview of doctypes, browser types and resulting browser modes.

    With respect to the funny string of Asian characters - I did some further research on this and discovered where it comes from. I opened a new file in UltraEdit, converted it from utf-8 to unicode first and then copied the text. The result in hex view reveals it all:

    Little Endian

    As we see, it's just the xml file uploaded, plus a preceding byte order mark FF FE, which according to wikipedia is a utf-16 Little Endian one:

    byte order mark

    Now for the messages in the console: the order of events in the browser is apparently as follows:

    1. get XML file
    2. get referred XSL file and apply transformation (XML5001); process result
    3. BOM = FF FE which is utf-16 overrides utf-8 mentioned in xml header (HTML1114)
    4. IE9 notices missing doctype, switches to quirks mode (HTML1113) and reloads result file again
    5. Again, BOM encoding overrides xml header encoding (HTML1114)
    6. File displayed
    0 讨论(0)
提交回复
热议问题