What advantage are we gaining by generating XHTML1 Transitional pages with that doctype? As in all likelihood, our servers are dishing out the generated webpages as text/html ... if they weren't, IE6 users in particular would be "locked out".
In my own mime.types in Apache's conf, I have nothing set up for php ... I have (as standard)
application/xhtml+xml xhtml xht
application/xml xml xsl
application/xml-dtd dtd
application/xml-external-parsed-entity
text/html html htm
and in httpd.conf there's
AddType application/x-httpd-php .php
So how would I set up the mime.type for true xhtml pages? Probably by adding php to the application/xhtml+xml line. But does anyone actually do that?
In fact if I add
AddType application/xhtml+xml .xhtml .xht .php
to my httpd.conf file in the <IfModule mime_module> section (the recommended place to add in extra mime.types), I get XML parsing errors.
In which case, why don't we use HTML 4.01 as the standard for PGV pages?
What determines if my document is HTML or XHTML?
You may be a bit thrown off by the last sections talk of treating an XHTML as HTML. After all, if my document is XHTML, that should be the end of the story, right? After all, I put an XHTML doctype! But it turns out that things are not so simple.
So what really determines if a document is HTML or XHTML? The one and only thing that controls whether a document is HTML or XHTML is the MIME type. If the document is served with a text/html MIME type, it is treated as HTML. If it is served as application/xhtml+xml or text/xml, it gets treated as XHTML. In particular, none of the following things will cause your document to be treated as XHTML:
Using an XHTML doctype declaration
Putting an XML declaration at the top
Using XHTML-specific syntax like self-closing tags
Validating it as XHTML
In fact, the vast majority of supposedly XHTML documents on the internet are served as text/html. Which means they are not XHTML at all, but actually invalid HTML that’s getting by on the error handling of HTML parsers. All those “Valid XHTML 1.0!” links on the web are really saying “Invalid HTML 4.01!”.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Jeffry Zeldman's recent post at http://www.zeldman.com/2009/07/07/in-defense-of-web-developers/ is well worth reading. There are numerous reasons, but the main reason I would not want to use HTML is that HTML is actually harder for developers, since the XHTML syntax has clearer rules and are easier for developers to use, the better to avoid tagsoup. It is an overly puristic (and simplistic) approach to call XHTML served as text/html as broken.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What advantage are we gaining by generating XHTML1 Transitional pages with that doctype? As in all likelihood, our servers are dishing out the generated webpages as text/html ... if they weren't, IE6 users in particular would be "locked out".
In my own mime.types in Apache's conf, I have nothing set up for php ... I have (as standard)
application/xhtml+xml xhtml xht
application/xml xml xsl
application/xml-dtd dtd
application/xml-external-parsed-entity
text/html html htm
and in httpd.conf there's
AddType application/x-httpd-php .php
So how would I set up the mime.type for true xhtml pages? Probably by adding php to the application/xhtml+xml line. But does anyone actually do that?
In fact if I add
AddType application/xhtml+xml .xhtml .xht .php
to my httpd.conf file in the <IfModule mime_module> section (the recommended place to add in extra mime.types), I get XML parsing errors.
In which case, why don't we use HTML 4.01 as the standard for PGV pages?
== for example reference ==
http://webkit.org/blog/68/understanding-html-xml-and-xhtml/
What determines if my document is HTML or XHTML?
You may be a bit thrown off by the last sections talk of treating an XHTML as HTML. After all, if my document is XHTML, that should be the end of the story, right? After all, I put an XHTML doctype! But it turns out that things are not so simple.
So what really determines if a document is HTML or XHTML? The one and only thing that controls whether a document is HTML or XHTML is the MIME type. If the document is served with a text/html MIME type, it is treated as HTML. If it is served as application/xhtml+xml or text/xml, it gets treated as XHTML. In particular, none of the following things will cause your document to be treated as XHTML:
Using an XHTML doctype declaration
Putting an XML declaration at the top
Using XHTML-specific syntax like self-closing tags
Validating it as XHTML
In fact, the vast majority of supposedly XHTML documents on the internet are served as text/html. Which means they are not XHTML at all, but actually invalid HTML that’s getting by on the error handling of HTML parsers. All those “Valid XHTML 1.0!” links on the web are really saying “Invalid HTML 4.01!”.
One page that describes a method for serving xhtml php pages correctly to browsers (and W3C validator) depending if they can handle xhtml fully is
http://www.workingwith.me.uk/articles/scripting/mimetypes
Mark
Jeffry Zeldman's recent post at http://www.zeldman.com/2009/07/07/in-defense-of-web-developers/ is well worth reading. There are numerous reasons, but the main reason I would not want to use HTML is that HTML is actually harder for developers, since the XHTML syntax has clearer rules and are easier for developers to use, the better to avoid tagsoup. It is an overly puristic (and simplistic) approach to call XHTML served as text/html as broken.
Has anyone tried serving up PGV pages using application/xhtml+xml rather than text/html?
PHP is a dynamic language capable of output in /any/ MIME type (html, jpeg, excel), so you don't change it in your httpd.conf file.
Your php.ini file should contain a directive as to the default MIME type for output :
default_mimetype = "text/html"
default_charset = "utf-8"