Re:Everything you Know About XHTML Is wrong
by pan69 on Saturday October 02, 2010 @04:40AM
(#1750084)
Should an XHTML document start with a typical <?xml version="1.0" encoding="UTF-8" ?> header?
[ Parent
| on HN ]
Re:Everything you Know About XHTML Is wrong
by olavk on Saturday October 02, 2010 @11:22AM
(#1750600)
Depends if you target the browsers HTML parser or XHTML parser.
Include it if you target the XHTML parser. (Note that if you target the XHTML parser, IE will not show the document at all.) Leave it out if you target the HTML parser. (But if you target the HTML parser, you might as well use HTML.)
Theoretically you could target both HTML and XHTML parsers with the same document, e.g. by using content negotiation. Since this is a lot of hassle and has no real benefit, not a lot of people does this. But in this theroretical case the correct is to leave the prolog out, since it is optional in XML and illegal in HTML.