views:

138

answers:

2

I need to open a *.bat file in a popup window. The way i do that is i open the popup window, which has a url set to the action of the downloading service.

The downloading service returns the following headers:

192.168.000.195.08080-192.168.000.201.52131: HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Disposition: inline; filename="version.bat"
Content-Type: text/plain
Content-Encoding: gzip
Vary: Accept-Encoding
Date: Tue, 11 Aug 2009 14:54:09 GMT
Connection: close

At this point, all browsers that arent IE display the bat in the popup window, while IE 7 closes the popup immediately!

Question: what content-type should i return in order for IE to open the bat file in the popup (not present a download prompt)

+1  A: 

Most of the time IE simply ignores the content-type and just goes for the file extension to figure out what it should do. I do not think you can circumvent this.

Maybe you should try setting it to text/html or something similar (text/xml) that really just has to be displayed.

Niko
@Niko: Edited your answer to remove the editorial on IE and Windows, which is unnecessary and contributes nothing to answering the question.
Grant Wagner
text/html worked =)
mkoryak
+1  A: 

Handling MIME Types in Internet Explorer explains the steps Internet Explorer uses to determine how to handle a file.

As long as you are using Windows XP SP2 or later, and in Tools > Internet Options... > Security tab > Custom Level... > Miscellaneous > Open files based on content, not file extension is set to Enable for your content zone, you should get the behavior you want.

Grant Wagner