0

While I'm sending a HTTP response, is it okay to send a partial HTML as text/html?

e.g.

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 12

<p>hello</p>

It seems incorrect because the content is invalid HTML document.

npcode
  • 1,370
  • 1
  • 14
  • 29
  • OK to whom? Invalid HTML is served as text/html all the time, since a large proportion of the web is made up of pages with at least some invalid markup. – IMSoP Nov 04 '13 at 02:45
  • Besides, since many start and end tags are optional, this fragment is _almost_ error-free HTML! – Mr Lister Nov 04 '13 at 12:24
  • @IMSoP OK to every web clients which obey HTTP/1.1 and HTML 4.01 specification. I want that my web site works correctly to every clients which obey the specifications. – npcode Nov 10 '13 at 13:28
  • @MrLister I think this fragment is very incomplete because it does not have a head element. – npcode Nov 10 '13 at 13:31
  • The head element has optional start and end tags; you can leave those out. Only the contents need to be there. `

    Hello` is a valid HTML file.

    – Mr Lister Nov 10 '13 at 19:03

0 Answers0