Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Trang web này sẽ có chức năng hạn chế trong khi chúng tôi trải qua bảo trì để cải thiện trải nghiệm của bạn. Nếu một bài viết không giải quyết được vấn đề của bạn và bạn muốn đặt câu hỏi, chúng tôi có cộng đồng hỗ trợ của chúng tôi đang chờ để giúp bạn tại @FirefoxSupport trên Twitter và /r/firefox trên Reddit.

Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Tìm hiểu thêm

Download link doesn't work

  • 8 trả lời
  • 2 gặp vấn đề này
  • 1 lượt xem
  • Trả lời mới nhất được viết bởi 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

Được chỉnh sửa bởi neus1 vào

Tất cả các câu trả lời (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.