1

We have a simple html page with a list of links on a Tomcat server. Many of the links are just a simple .msg file for users to download, fill-in and send. Works great in Chrome but not in IE. IE tries to load the .msg file and all you see is 'garbally gook'.

I've tried searching for answers but none have worked so far.

Tried: - Adding 'download' to the tag but of course this isn't supported in IE. - Tried adding a .htaccess file with: AddType application/octet-stream .msg, but this didn't work either.

Tomcat is by Apache so I'm really surprised the .htaccess file answer didn't work. Some answers suggested using PHP or adjusting config files, but this is a little over my head. Who would have thought such a seemingly simple question would be so technical to fix!

Many thanks for any direction you are able to suggest!

cfqgy
  • 13
  • 4
  • Using PHP would be a great solution. Check http://stackoverflow.com/questions/7263923/how-to-force-file-download-with-php for more information. – Sablefoste May 13 '15 at 20:36

1 Answers1

0

I finally found my answer so for the next none techy, hopefully this will help you too!

For Apache Tomcat, find your web.xml and open in Note Pad. Search for MIME, you want to keep going until you find your MIME types, they will look like the below code. They are sorted alphabetically so place your new MIME type accordingly. For me it was a .msg file that I wanted IE to prompt an open/save as, rather than just trying to opening it.

<mime-mapping>
<extension>msg</extension>
<mime-type>application/vnd.ms-outlook</mime-type>
</mime-mapping>

To find the appropriate MIME type, I just did a Google search for 'Outlook .msg MIME Type' and found it pretty quickly. After you have added your new MIME Type save and restart your server.

Issue: web.xml wouldn't let us save over it. We got around this by saving our new file with a different name, rename/delete the existing web.xml file and then renaming the updated file back to web.xml.

Issue: After restarting the server, IE STILL tried to read the .msg file rather than opening it, even after refreshing cache, grrrr! Trying another link we hadn't tried before, revealed the new MIME Type to be working and testing on another computer confirmed it.

Good luck!

cfqgy
  • 13
  • 4