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!

为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Firefox not handling downloads from many Web sites

more options

Some time ago, many banking and other financial Web sites began to offer only one dual option: "View/Download". The Web site then performs a function depending on the Web browser's settings. Unfortunately, the Firefox "Files and Applications" settings don't seem to allow for this dual-option icon.

For example, in my case, this usually involves PDFs. Most often I just want to view the file and then decide if I want to save it. Or, I know that I only want to view the file and don't want to save it. If "Always Ask" is selected in the browser and you click the "View/Download" icon, the Web site asks you if you want to open the file or save it. If we ask to open it, the Web site also downloads it in the background. If we select to save it, the file is saved without our being able to view it.

If I set the PDF file type in Firefox to "Adobe Acrobat", then then Firefox opens the PDF in Acrobat where I can view it and also saves it in the background to the download location set in Firefox. This results in a lot of time being spent going to the download location and deleting a list of unwanted downloads. When I finally realized that this was happening, I had a huge list of unwanted files.

No option allows us to view without downloading. Is there a way to fix this? Thx

Some time ago, many banking and other financial Web sites began to offer only one dual option: "View/Download". The Web site then performs a function depending on the Web browser's settings. Unfortunately, the Firefox "Files and Applications" settings don't seem to allow for this dual-option icon. For example, in my case, this usually involves PDFs. Most often I just want to view the file and then decide if I want to save it. Or, I know that I only want to view the file and don't want to save it. If "Always Ask" is selected in the browser and you click the "View/Download" icon, the Web site asks you if you want to open the file or save it. If we ask to open it, the Web site also downloads it in the background. If we select to save it, the file is saved without our being able to view it. If I set the PDF file type in Firefox to "Adobe Acrobat", then then Firefox opens the PDF in Acrobat where I can view it and also saves it in the background to the download location set in Firefox. This results in a lot of time being spent going to the download location and deleting a list of unwanted downloads. When I finally realized that this was happening, I had a huge list of unwanted files. No option allows us to view without downloading. Is there a way to fix this? Thx

所有回复 (1)

more options

I apologize that the following is long, but I wanted to provide some more background and options for opening PDFs.

Step #1: Switch to the Open in Firefox option

Firefox can't display PDFs without downloading and saving them somewhere. This option is the only one that uses the web content cache instead of the Downloads folder or Temp folder.

Step #2: Force PDFs to save in the web content cache

If web servers don't specify how Firefox should handle a PDF, or if they specify "inline" handling, then then Firefox loads the PDF as web content with its original URL in the address bar. The PDFs are saved with other cached web content, not in your download folder. This is good.

But web servers can try to force a download by setting Content-Disposition: attachment if they don't want browsers to show the files in a tab. Firefox changed what it does in this case:

Before Firefox 98: Firefox always showed a download dialog, even though you had already told Firefox what you wanted to do, even when you checked the box to always do this in the future. It was kind of infuriating.

Firefox 98+: Firefox downloads the file automatically and then opens it. Because these are saved to disk the URLs start with file:///. By default, they are saved in your "Save files to" folder on the Settings page.

In response to user suggestions/complaints, Mozilla added two options to modify the above:

(A) Just for PDFs, override "attachment" disposition to "inline"

When your handling action is "Open in Firefox", all PDFs can now be opened as web content and saved in the cache instead of a regular folder. Here's how you set this up:

(i) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.

More info on about:config: Configuration Editor for Firefox. The moderators would like us to remind you that changes made through this back door aren't fully supported and aren't guaranteed to continue working in the future. I'm using this so I feel comfortable mentioning it.

(ii) In the search box in the page, type or paste browser.download.open_pdf_attachments_inline and pause while the list is filtered -- requires Firefox 103 or later

(iii) Double-click the preference to switch the value from false to true

(B) [optional] For all the downloads Firefox saves to disk and opens automatically, change from the "Save files to" folder to the Windows Temp folder (if you made the change in #1, this will affect other kinds of files rather than PDFs)

Here's how you access it:

(i) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.

More info on about:config: Configuration Editor for Firefox. The moderators would like us to remind you that changes made through this back door aren't fully supported and aren't guaranteed to continue working in the future.

(ii) In the search box in the page, type or paste browser.download.start_downloads_in_tmp_dir and pause while the list is filtered -- requires Firefox 102 or later

(iii) Double-click the preference to switch the value from false to true

This would not affect files opened with inline disposition; those will still be in the web content cache.

Are we getting closer?