Skip to content

Serving Internet Explorer XHTML, Part Ⅱ

After composing the excedingly long post below, I reset Opera to its default configuration of identifying itself as Internet Explorer. I discovered, to my horror, that not only did it have the magical MSIE string, but the entire string, right up to the word Opera, was identical to what IE sends. So that means my URL rewrite filter needs yet another line added to it, so that IE 6.0 and below are greeted with the text/html MIME type and every other browser, search engine, or other Web tool is served XHTML pages with the proper application/xhtml+xml MIME type.

Now, many readers will take one look at my use of browser sniffing and dismiss my method as being evil, because it is so browser-dependent. But that is exactly the point—to filter out but one class of browser for special treatment, not provide special treatment for each different browser. I will not add another line to this filter to make sure MSIE 6.1 or 7.0 gets the same treatment—those users will be SOL unless Microsoft fixes the problem with IE not advertising supoprt for XHTML.

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} \.xhtml$
RewriteCond %{THE_REQUEST} HTTP/1\.1
RewriteCond %{HTTP_USER_AGENT} "Mozilla\/4.0 \(compatible; MSIE 4" [OR]
RewriteCond %{HTTP_USER_AGENT} "Mozilla\/4.0 \(compatible; MSIE 5" [OR]
RewriteCond %{HTTP_USER_AGENT} "Mozilla\/4.0 \(compatible; MSIE 6.0"
RewriteCond %{HTTP_USER_AGENT} !Opera
RewriteRule .* - [T=text/html;charset=UTF-8]

Now that I have this in place, I have startet testing the search engines. Google, as known, fails, and has been sent a complaint through their feedback form. I’ll wait a week or three before testing the others, so their apparently slower crawl cycles can find the new me.

Posted in Standards, Web.

No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

You must be logged in to post a comment.