In your webpage, there is a hyperlink in your web is as such http://localhost:8080/webname/help.chm. You could not click it, as it will open as a garbage, alien language in your Internet Explorer. Have you come across with such problem?
No matter how I write the javascript, I can't manage to get it to "force" download using javascript. It will always open it as garbage. At last, I turn to my manager. He told me to use mime-mapping in web.xml.
After some research online, found that we can actually tell app server that such "extension" is a certain file type. As simple as 1-2-3, we just need to add these codes in the web.xml correctly. You might want to verify the placement.
<!-- set mime mapping for help file -->
<MIME-MAPPING>
<EXTENSION>chm</EXTENSION>
<MIME-TYPE>application/mshelp</MIME-TYPE>
</MIME-MAPPING>
Likewise, for other extension, we may put it as other mime-type, such as "application/pdf" for pdf, "application/vnd.ms-excel" for xls and others. You should be able to get the correct type by browsing the net.
After saving your web.xml, you just need to restart your app server and clear your temporary Internet file.
1 comment:
cool tips.. thanks dude :)
Post a Comment