# Make Internet Explorer render XHTML

## Internet Explorer 6

### unsafe

Internet Explorer has many problems. One general problem is that its support for web standards is so lacking and defective that it is does not deserved to be called a browser. In particular, it still does not support XHTML.

### XHTML

When you visit an XHTML page, Internet Explorer 6 does not render the page, but tries to download it as a file. If you have Windows XP Service Pack 2, you get an yellow Information Bar that accuses the site of trying to download a file. The site did not such thing, the decision to download the page instead of rendering it is Internet Explorer’s own fault.

Internet Explorer is fouling up and falsely accusing XTHML sites. False positives are a serious security blunder, but that is a separate matter. The problem at hand is that Internet Explorer does not show the page.

Internet Explorer 6 does not render the page, but tries to download it as a file. That defective behaviour is a problem, but there are various solutions.

#### solutions

There are three solutions; upgrade to a browser, upgrade to a later version of Internet Explorer or apply the quick fix described here.

## Internet Explorer can render XHTML as HTML

Internet Explorer 6 fails to render XHTML, and That’s odd. Microsoft is not going out of its way to tell everyone, but it is quite simple to make version 6 do the same thing as version 7 often does; render XHTML as if it was mere HTML. It is not the same thing as real XHTML support, so don’t expect XHTML pages to look as good as they do in Opera or Firefox, it is just lot better than showing nothing.

### Registry entries

Making Internet Explorer behave this way is just a matter of adding a few registry entries, and you don’t need to do that by hand. A script is provided below. Another script, to remove the entries again, is provided too.
Without the extra registry entries, Internet Explorer 6 will fail to show an XHTML page at all. It does not recognise XHTML and therefore decides to do what it always does for file types it does not understand; it decides to treat it as a download.

### Information Bar

From Windows XP Service Pack 2 onwards, Internet Explorer 6’s behaviour is considerably more annoying than failing to render and offering to download the file. Instead, it shows the yellow Information Bar along the top of the page and, if you have not turned that off yet, shows a dialog to alert you to the presence of that Information Bar. The one option the Information Bar offers you when you check out its context menu is to download the file, but you don’t want to download and save the file, you just want to view the page.

To do so, run the script to insert the extra registry entries. You do not even need to close down and restart Internet Explorer. Then, when you visit the XHTML page again (just hit F5 to refresh the page), Internet Explorer does not complain, does not show an Information Bar, but simply renders the page as HTML. It’s magic!

### how it works

Here’s how this trick works. The registry contains a list of the so-called MIME types and their registered viewers. That list has an entry for HTML, but lacks an entry for XHTML. Whenever Internet Explorer receives something, it checks the associated MIME type against that list. If the type is in there, it uses the registered viewer to render it. If the type is not in there, it decides to treat the unrecognised type as a download.

The registry script add a value for XHTML, that points Internet Explorer to the HTML viewer by providing exactly the same values as the entry for HTML does. Result: Internet Explorer now recognises the XHTML MIME type and decides to render it as HTML.

### the files

I’ve provided a few scripts files. The MimeTypeHTML.reg file shows what the HTML entry looks like. The MimeTypeXHTML.reg inserts the same values for the XHTML entry, and the DelMimeTypeXHTML.reg will remove it again.

You can have some testing fun adding and removing the registry entries. Add the entries to make it work, remove the entries to stop it working again. It is that simple.

#### why not?

Really makes you wonder why Microsoft didn’t configure Internet Explorer do this automatically - perhaps because Internet Explorer should be showing a bar along the top saying something like "Internet Explorer is about a decade behind current web standards. It still does not support XHTML at all. We’ve rendered this XHTML page as HTML to give you some idea what it looks like in a real browser" and round that off with "We recommend that you use a real, modern capable browser such as Opera or Firefox to view this page.". Somehow, I doubt that Microsoft is ever going to be that open and honest to its Internet Explorer users.

### installation

When you run the script, you may get an alert from Microsoft AntiSpyware or similar programs that you are running an unknown script. You will need to approve running the script to make the necessary registry changes.

You will always get two message boxes. The first messagebox asks "Are you sure you want to add the information in MimeTypeXHTML.reg to the registry", and the second one confirms that "Information in MimeTypeXHTML.reg has been successfully entered into the registry.".

### verify

To verify that that adding this registry entry solves the Internet Explorer 6 problem, simply surf to the home page of this web site. To see that it solves the problem for Internet Explorer 7 too, you need to try an XHTML page that Internet Explorer 7 would otherwise throw up a download dialog for. The links section lists a few test pages.

### origin

This little trick is several years old already. I do not know who came up with it, and it may well be that several people thought of this independently of each other. The oldest mention I found is a 2004 blog post by Peter Provost, who happens to be a developer working for Microsoft…

## limitations

This trick does not magically transform Internet Explorer into a modern browser. This is merely a practical fix for a practical problem. Again, rendering XHTML as HTML is not real XHTML support, it just happens to be good enough for most XHTML sites, and it is much better than showing nothing. The real fix remains upgrading to a modern browser.

### all versions

This solution does not just work for Internet Explorer 6, it works for Internet Explorer version 7 and 8 too. It does not depend on the Internet Explorer version in any way. It makes smart use of the way how Internet Explorer decides to what to do with a page. As long as Internet Explorer keeps consulting the MIME database in the Registry, this solution continues to work.

### future

One day, a new version of Internet Explorer may finally adds support for XHTML. When that happens, you may already have forgotten that you inserted an extra MIME entry into the Registry once, but that does not matter. You do not need to remove it. The setup for the new version will overwrite the XHTML entry with new and better settings, that point to real XHTML support, and That’s that.

## the registry scripts

### MimeTypeHTML.reg

This is the registry script you get when you export the existing HTML entry.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\MIME\Database\Content Type\text/html]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Extension"=".htm"
"Encoding"=hex:08,00,00,00

### MimeTypeXHTML.reg

This registry scripts inserts the XHTML entry that makes Internet Explorer render XHTML like HTML.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/xhtml+xml]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00
"Extension"=".xhtml"

### DelMimeTypeXHTML.reg

This registry script deletes the XHTML entry.

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/xhtml+xml]

#### techno-talk

Compare the MimeTypeHTML.reg and the MimeTypeXHTML.reg registry script files. The only difference between the scripts in the two files is the MIME type. The MimeTypeHTML.reg file was created by exporting the registry key for HTML. The MimeTypeXHTML.reg file was created from the HTML file by changing text/xml into application/xhtml+xml. The rest of the script was left unchanged. The practical upshot is that when Internet Explorer find the XHTML entry, it is pointed towards exactly the same viewer in exactly the same way as it would find in the HTML entry.

All you need to know is that both entries are the same, but in case you are wondering, both entries point towards classid 25336920-03F9-11cf-8FD0-00AA00686F13, which is a magic number for the mshtml.HTMLDocumentClass object in MSHTML.DLL. That is Trident, Internet Explorer’s rendering engine.