Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Download link doesn't work

  • 8 majibu
  • 2 wana tatizo hili
  • 1 view
  • Last reply by neus1

more options

Hello,

On my website I have a button to download my book in EPUB format. You can see it here: https://imwithlorac.com/get-the-book/#downloads

In the other browsers the file is downloaded, but in Mozilla it opens directly in the browser and unless you have installed in Mozilla an EPUB reader, a page with the raw file opens which does not make any sense. It's the same with the MOBI format. On the other hand, with the PDF format the PDF book opens because Mozilla can open PDF files. What I want is that it doesn't open, but that it downloads when people click on the link.

Does anyone know how?

Thanks

Hello, On my website I have a button to download my book in EPUB format. You can see it here: https://imwithlorac.com/get-the-book/#downloads In the other browsers the file is downloaded, but in Mozilla it opens directly in the browser and unless you have installed in Mozilla an EPUB reader, a page with the raw file opens which does not make any sense. It's the same with the MOBI format. On the other hand, with the PDF format the PDF book opens because Mozilla can open PDF files. What I want is that it doesn't open, but that it downloads when people click on the link. Does anyone know how? Thanks

Modified by neus1

All Replies (8)

more options

Unfortunately, your web server appears not to have a content-type (mime-type) defined for .epub so it is setting this header:

Content-Type: text/plain

which Firefox figures it can handle by throwing it into a tab.

The proper type is:

Content-Type: application/epub+zip

Can your web host help you get that set up? If you are on your own, a common way to add this would be in a .htaccess file, but it's a little beyond the scope of this forum.

(For .mobi I think you want "application/x-mobipocket-ebook" but I'm not completely sure of that.)

more options

Hi, Thank you for answering! I did as you suggested but it didn't work and I left the link as it was before. Do I have to add ";" at the end or at the begining (I put it at the end)? Do I have to define text/plain before? Because there wasn't any. Do I have to wait hours? Because I thought it would be immediate, so just press Ctr + F5 and saw it didn't work. Thanks.

more options

neus1 said

Hi, I did as you suggested but it didn't work and I left the link as it was before.

Hi, it's not about changing a link, you have to add this specific content-type to server settings.

If you're unable to do it, you can try to add download parameter to <a> (I'm not sure if it's going to work).

more options

That's been helpful. But I can not modify the parameter <a> because it's from one plugin that counts the number of clicks on that link. Question: Where is located the server settings? Is it the htaccess? Thank you!

more options
more options

Hi, I've done this: https://www.rtcom.me/epub-e-mobi-su-wordpress/ I've purged the server cache (I have the server LiteSpeed) and still doesn't work. Any clues? Thanks,

more options

Hi neus1, that page seems to give you two different kinds of advice.

The first change, which is an edit to the .htaccess file created by WordPress, sets up the proper content/mime type associations.

The second change, which is an edit to the functions.php file, overrides those content/mime types with a generic type. This will force Firefox to always show the download dialog (Open/Save/Cancel) instead of using the instructions on the Options/Preferences page.

If you are still getting gibberish in a tab, then neither of those changes is taking effect.

Do you want to try a WordPress plugin instead? I haven't tested this one, but I see the author is actively providing support:

https://wordpress.org/plugins/wp-add-mime-types/

more options

Solved!

I had the files in a subdomain. I took them out of there and put them in a folder. It's been working ever since. Now in Firefox a popup window opens asking you if you want to open the file or save it.

Thank you.