简体   繁体   中英

Internet Explorer cant open Microsoft Word file with extension “.DOC”

My Java web application is having a document file. When I try to download the file by clicking the link It opens a new page with corrupted characters as another tab. When i try to save the page it saved as .htm file

But the file is downloaded properly in other browsers like Chrome , Firefox. I do a check by changing the extension from .DOC to .doc and I can able to download the file.

Is there a particular reason that .DOC opens a corrupted page in IE. Why it is only happening in IE

I just encountered the same issue and found the cause to be a missing MIME type mapping on the application server (in my case, Tomcat). For Tomcat, you would fix this by adding the following to conf/web.xml:

<mime-mapping>
    <extension>doc</extension>
    <mime-type>application/msword</mime-type>
</mime-mapping>

The exact file you'd need to edit will vary, based on your application server, but a quick Google search for your AS and "mime type mapping" should tell you what you need to edit and where.

I should note that older versions of Tomcat (released before Tomcat 8) are case sensitive for MIME type mappings, so if you find that .doc works but .DOC doesn't, add an additional entry to the web.xml file with DOC as the extension.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM