Serving Internet Explorer XHTML, Part â…¡

Twitter Updates


San Francisco PechaKucha Night
San Francisco IxDA


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.

Author: Peter Sheerin

Peter Sheerin is best known for the decade he spent as the Technical Editor of CADENCE magazine, where he was the acknowledged expert in Computer-Aided Design hardware and software. He has a long-standing passion for improving usability of software, hardware, and everyday objects that is always interwoven in his articles. Peter is available for freelance technical writing and product reviews, and is exploring career opportunities in interaction design. His pet personal project is exploring the best ways to harmonize visual, tactile, and audible symbols for improving the effectiveness of alerting systems.

Leave a Reply