views:

106

answers:

1

Is there anyway to force Internet Explorer to prompt for download of XML files instead of automatically displaying them? A code solution or just a set of IE configuration steps would be fine.

Even if I use the wrong extension, IE uses "content sniffing" to determine that is XML and opens it automatically anyway.

I'd rather have the Open/Save/Cancel dialog instead.

Thanks in advance

+1  A: 

You need to set the Content-Disposition HTTP header to "attachment". Doing this will be different depending on which framework or web-server you're using. For instance, in PHP you can use the following code:

header('Content-Disposition: attachment; filename="myfile.xml"');
header('Content-Type: application/xml');
Travis
This worked, thanks
mjmarsh