views:

1147

answers:

1

I've been beating my head against the wall trying to figure out how I can force IE to download and open a Word document in Word instead of opening in Word window embedded inside of IE. Googling around, all I can find are instructions like this one http://www.shaunakelly.com/word/sharing/OpenDocInIE.html which show how to configure the setting in Windows "File Types". This works fine, but I can't make sure that everyone accessing my site has their Window's settings the same.

I know this is possible, because when I download Word documents sent to me as attachments from in our company webmail (or in Gmail) site using the same IE browser the attachments are always downloaded and opened in Word instead of Word embedded in IE. Is there some kind of heading sent by the webserver that forces this to happen?

We are using IE6, Office 2003 and Windows XP. If it matters, the website is using Django running on Apache and mod_wsgi.

Thanks!

UPDATE:

I added the following lines to my .htaccess and now IE opens the files in Word directly.

<Files *.doc>
  Header set Content-Disposition attachment
</Files>
+3  A: 

You will want to add the "Content-Disposition" header to the response and suggest a filename to use. This example is for Excel, but the same applies to word, it's the header that the browser sees and then acts on when it comes to displaying the file in the browser, or suggesting it be saved.

See the section titled "Beautify Your Output With HTML" here:

http://www.aspnetpro.com/NewsletterArticle/2003/09/asp200309so_l/asp200309so_l.asp

casperOne