0

I have content with mime type set as application/x-chm, which as I understand it, enable downloading of chm files. However when I select the link which triggers the save/open file dialog the .chm file extension is not resolved and I have to explicitly add the .chm file extension for the file to be saved. How can I get the .chm file extension to resolved automatically?

1 Answers1

1

According to this official IANA document, the MIME-type for .chm files is application/vnd.ms-htmlhelp.

Side note, you never know for sure how the file is being displayed to the user, since the user can choose how to display a file themselves.

Rob W
  • 341,306
  • 83
  • 791
  • 678
  • Thanks for your response Rob. Unfortunately changing the mime type still has no effect. In response to your comment above I don't have control of the code which handles the download I only have access to the code which loads the content to our database. Pdfs, which are downloaded in the same manner and have a mime type set to application/pdf work as expected. – Mark Walsh Jun 19 '12 at 08:36
  • @MarkWalsh By headers, I mean the (server) response headers. For example, see http://stackoverflow.com/q/2868976 (I was referring to `filename=...`). These headers can be inspected in various devtools, e.g. in Chrome: http://stackoverflow.com/q/4423061. – Rob W Jun 19 '12 at 08:44
  • For chm files the header has Content-Type = application/vnd.ms-htmlhelp and Content-Disposition = attachment; filename="payload". While for pdf files the header has Content-Type = application/pdf and Content-Disposition = attachment; filename="payload". – Mark Walsh Jun 19 '12 at 15:46
  • Did it occur to you to use `filename="payload.chm"`? I can confirm that `.pdf` is automatically added using your headers (Chrome 18). – Rob W Jun 19 '12 at 20:08
  • Ah yes, this is the thing. If the download file name retains a .chm file extension all is fine. However, in the instance I have outlined, the .chm files are given aliases which don't contain the .chm file extension and I don't have access to the code base which handles this, only the code which loads the data to the DB. So it looks like I am out of luck but thanks for all the help Rob, much appreciated. – Mark Walsh Jun 20 '12 at 08:30