Why IE11 gives this warning: HTML1406: Invalid tag start: "<?"

My pages are written and declared as XHTML 1.0 Strict. The first lines are as follows:

<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> 

That I believe correctly for XHTML 1.0 Strict, but nonetheless IE11 gives this warning:

 HTML1406: Invalid tag start: "<?". Question marks should not start tags. File: default.aspx, Line: 1, Column: 2 

Does anyone know if this is what I should worry about?

+8
html internet-explorer xhtml doctype internet-explorer-11
source share
2 answers

The problem is that although you created the XHTML doctrine file, you served it using the text/html media type.

In this way, IE11 (and other browsers) process the file as an HTML file and parse it using its HTML parser. Declaring XML in an HTML file is invalid and what the browser tells you. If you submitted a file of type application/xhtml+xml , the browser would process the file as XHTML and use its XML parser to parse it. Then the XML declaration will be processed correctly in accordance with the XML rules, and IE11 will not give you this warning message.

There is no real problem here. The HTML parser will process the declaration as a dummy comment and simply continue independently.

For more information you should read Submitting XHTML as text / html is considered malicious and / or HTML 4, HTML 5, XHTML, MIME is the ultimate resource

+12
source share

If you came here because you are working on an old (er) ASP.NET Web Forms application / site ... try turning on the Compatibility View ... which worked for me

0
source share

All Articles