Firefox renders html as text

I had a customer who’s site would display fine in Internet Explorer (IE) but as text in Firefox (FF).

Why this can happen:

When you click on a link, your browser sends an http request. The system at the other end evaluates the request, then sends back an http response header attached to the return file. NOTE: this is in addition to any statements included in the <head> section of the actual html document.

Browsers handle the reception of the response header transparently so the general user is not aware of it.

One of the functions of the http response header is to define what type of file is attached, via a “content-type” (often referred to as MIME type) declaration – this tells the browser how to handle the file. It is the responsibility of the server housing the files to send an appropriate content-type.

Sometimes the servers housing pages in question may not be configured correctly and deliver an http response header with an incorrect content type. Pages to be displayed as Html should have content type of “text/html”; plain text files should have content type of “text/plain”. If a file is served with some other content type that isn’t automatically displayed or handled by FF, it will ask you what to do with the file. If an html page is served with a content type of “text/plain”, FF does just as the http specs require and displays it as though it were plain old typed out text. IE, on the other hand, ignores the http standards, ignores the http header content-type, and takes its own best guess on how to handle the file – consequently many server admins aren’t even aware of the problem if they are serving the files wth the wrong content type.

A list of media types can be found here:

How to check:

You can see what content type was received by FF. Right-click on an empty part of the displayed page and choose “View Page Info” from the resulting menu. Under the General tab, look at the “type” line.

If you’re not convinced (or don’t trust what FF tells you, or if the page isn’t displayed by FF so you can’t view its page info), go to and enter the URL of your page. Then scroll down to the reply header that is displayed and see what is listed as “content type”.

If an inappropriate content type is being sent, you can change this via the .htaccess file or contact the webmaster, as this can only be fixed at the server.

How to fix it:

Edit the .htaccess file at the root of your site and place the following line. Alter it to reflect what you are sending. In my clients case they had changed their .html files to the extension .jsp. There is no jsp capability at the web server and the pages were simple html, so the following worked fine.

#### Configure Mime Types ######################################################
AddType text/html html jsp

A great tool for creating .htaccess files is the .htaccess file generator:

Possible work arounds:

A trick that in some people have reported works in some cases that may help you view the page as intended: click the Reload button. This will reload the page as cached on your computer. BUT even if this works for this page this doesn’t correct the situation for anybody else so you still should alert the webmaster to the problem.

And as a final workaround, you can install the Force HTML bookmarklet found here:
Go to that page and drag the “Force HTML” link to your bookmarks toolbar. When you find a page that displays the html code due to improper content type, click on the Force HTML bookmark and it will cause the FFox to interpret the page as html. But once again, this doesn’t correct the situation for anybody else so you still should alert the webmaster to the problem.

Many thanks to Doug Wilson for contributing this.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.