IE does not parse HTML correctly

Here is a snapshot of my HTML code when viewed after clicking the "View Source" button in IE9 . I open in Notepad ++

Snapshot of my HTML code

Here is the code parsed by the IE9 development tool:

enter image description here

Why is there a gap between the two?

+1
dom html internet-explorer
source share
2 answers

As @Shadow Wizard explained in a comment, the likely reason is some data character before the <!DOCTYPE ...> declaration. For example, the problem is reproducible by taking a valid XHTML document and inserting a space-free character (NBSP, U + 00A0) at the very beginning of the document. But having the specification in the beginning does not cause a problem (at least not on IE 9, hardly on any browser used). There are a large number of invisible or barely noticeable characters that can cause a problem.

+1
source share

The developer tool does NOT show you the source of your code; it shows the DOM (Document Object Model) why there are differences. You can learn more about the DOM here: https://developer.mozilla.org/en/DOM/

The content shown in the Developer Tool presents your analyzed source with some changes to be more readable and without incorrect tags, in a nutshell it does not show the exact source.

+1
source share

All Articles