3

I have to generate a HTML page for Mobile Safari only. So I have chosen HTML in strict XML syntax. But I don't know how should I set MIME type for this kind of document.

1
  • 1
    This has to done at the HTTP level, either by server configuration or the server-side scripting language. What are you using?
    – Alohci
    Apr 24, 2011 at 9:55

1 Answer 1

3

You should set the mime as text/html, not application/xml.

The latter will put your browser in an unforgiving parsing mode, where any malformed syntax will cause the page to completely error.

Why does this matter? You may have a CMS or something external that accidentally places some invalid XML on your page; would you rather your site not be visible to anyone or would you rather the browser gracefully recover? I know what I would prefer.

Also, I believe HTML5 should always have the text/html mime type; the syntax you use is optional (self closing tags can have /> or just >).

5
  • 8
    What if the OP wants unforgiving parsing mode? I often do. Catches errors early. application/xml and application/xhtml+xml are both valid ways of serving XHTML5.
    – Alohci
    Apr 24, 2011 at 9:49
  • 1
    @Alohci if having your page unusable is an option for you, great. But I often have CMSs which don't always produce the best output.
    – alex
    Apr 24, 2011 at 11:38
  • 1
    I'm sorry guys, but I need the unforgiving parsing mode :) Because of exactly @Alohci said. And my page won't be unusable because my target browser is fixed.
    – eonil
    Apr 25, 2011 at 4:29
  • 1
    @Eornil Set it as application/xml then. Just because your target browser is fixed doesn't mean an XML error isn't a serious issue.
    – alex
    Apr 25, 2011 at 4:30
  • 2
    It is estimated that 99% of webpages are erroneous (mininum 1 error per page). Let us follow the standards and make the web cleaner. I would opt for unforgiving parse mode.
    – WarFox
    Jul 4, 2011 at 9:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.