views:

65

answers:

3

My website is working fine on IE, but when I open it on Firefox, Firefox asks to download the same page and opens the Download File dialog. This problem occurs sometimes in Safari also.

For example, if I type in the URL as:

http://www.example.com/news.html

Firefox opens a dialog to download "news.html". Whereas, it works fine in IE. Why?

+4  A: 

This appears to be a problem with the MIME type being sent by your server in the HTTP header. If you are using PHP, check for any header() calls being sent before the page is echoed.

Also, try sending an explicit HTTP header like this:

<?php
header ("content-type:text/html");

.... HTML / BODY / echo starts here
....
?>
Crimson
@Crimson: But it is a pure HTML page.
RPK
Can you give us a link to your actual site? Further, please ensure that the file extension is .html
Crimson
+2  A: 

Does your web.xml define mime types like the following?

<mime-mapping>
 <extension>.html</extension>
 <mime-type>text/html</mime-type>
</mime-mapping>
rsp
@rsp: Where is this file located?
RPK
For web applications this file is located in the `WEB-INF` directory relative to the web-app. Most application servers or HTTP servers have a global configuration facility to specify the mime types for files served from the filesystem. (Btw, if you use IIS you could try if using `.htm` does wirk as expected.)
rsp
+2  A: 

As some other answers suggest, this has to do with the Content-Type being sent. Using the addon Live HTTP Headers, you will be able to check which are sent. It should be text/html.

data