[wp-trac] [WordPress Trac] #4466: Serve application/xhtml+xml if browser compliant

WordPress Trac wp-trac at lists.automattic.com
Thu Jun 14 08:04:16 GMT 2007


#4466: Serve application/xhtml+xml if browser compliant
--------------------------+-------------------------------------------------
 Reporter:  werwin        |       Owner:  anonymous                   
     Type:  enhancement   |      Status:  new                         
 Priority:  low           |   Milestone:  2.3 (trunk)                 
Component:  Optimization  |     Version:  2.2.1                       
 Severity:  minor         |    Keywords:  xhtml, application/xhtml+xml
--------------------------+-------------------------------------------------
 Right now, Wordpress serves up the blog's headers by using
 {{{
 get_option('html_type')
 }}}

 which as far as I know, can only be changed in the database. Changing it
 to application/xhtml+xml would make sense, if the browsers would all
 handle it, but they all don't, which is why right now we have XHTML
 complaint pages served up as using the text/html mime type -- so
 everything can be viewed if the browser can't view the
 application/xhtml+xml mime type.

 However, I propose a 'hack' around this issue, which should allow the
 older browsers to still view the pages with the text/html mime type, and
 the newer browsers to view the pages with the application/xhtml+xml mime
 type.

 I'm not quite sure about all the code and just did a quick hack, which
 seems to work to my knowledge, so I won't include a diff, just a quick
 example of wp-includes/classes.php (~ 171)
 {{{
 @header("Vary: Accept");
 if (stristr($_SERVER[HTTP_ACCEPT], "application/xhtml+xml")) {
 @header('Content-type: application/xhtml+xml; charset=' .
 get_option('blog_charset'));
 }else if (stristr($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")) {
 @header('Content-type: application/xhtml+xml; charset=' .
 get_option('blog_charset'));
 }else{
 @header('Content-type: text/html; charset=' . get_option('blog_charset'));
 }
 }}}

 There are prettier and more proper ways, just throwing this option out
 there to see what people think.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4466>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list