Domanda

I need to allow users to click a link to a .bat file on an IIS 6.0 server directory and view that file as plain text. I have set the MIME type for .bat file to "text/plain." This works perfectly in both Chrome and Firefox. The way this works is that I have a button that launches a separate popup browser window to the .bat file. Example is below:

onclick=\"window.open(\'\/eemcontrolpanel\/jobs\/" + encodedFileName +"\',\'popUpWindow\',\'height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes\');\">View Script</button>").scrollHeight;

As I said, this works in both Chrome and Firefox, but for some reason, IE 8 immediately closes the popup and asks me if I want to Run or Save the file.

È stato utile?

Soluzione

I think IE goes by filename extension to detect its an executable file. Maybe you could give it another name by adding a header like:

'Content-Disposition: attachment; filename="thebat.txt"'
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top