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

搜索 | 用户支持

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

详细了解

Stop downloading PDFs and making URLs hard to find

  • 4 个回答
  • 1 人有此问题
  • 1 次查看
  • 最后回复者为 cor-el

more options

Firefox Developer Edition 85.0b4, macOS 10.15

If I Google for a PDF and click a link, I get the Firefox download dialog. If I select "Open with Firefox [Developer Edition]", the following things happen:

  • The PDF is downloaded to ~/Downloads
  • The PDF is opened in a new tab, with that new tab's location bar holding a file:///... URL to the downloaded PDF

What I would instead like to happen is:

  • The PDF is downloaded to some temporary directory where I won't have to worry about deleting it manually
  • In whatever tab the PDF is displayed in, the location bar contains the URL where the PDF was (temporarily!) downloaded from

How can I achieve this?

Not having the URL where a PDF was opened from is very annoying when, for example, I open a bunch of PDF search results to read and review, and I later want to share links to some of those PDFs. Best I can do to find their URLs to give to others is then to try and remember which tab corresponds to which search result, or do mine the downloads tab.

Contrast this with Chrome: I click a Google result for a PDF and the PDF just opens in the current tab with the URL to the PDF in the location bar. No dialogs, no PDF files hanging around in my home directory, and I can just copy the URL to the PDF the same way I'd copy the URL to any web page.

Thank you!

Firefox Developer Edition 85.0b4, macOS 10.15 If I [https://www.google.com/search?q=facebook+and+the+future+of+fair+housing+online+filetype%3Apdf Google for a PDF] and click a link, I get the Firefox download dialog. If I select "Open with Firefox [Developer Edition]", the following things happen: * The PDF is downloaded to ~/Downloads * The PDF is opened in a new tab, with that new tab's location bar holding a file:///... URL to the downloaded PDF What I would instead like to happen is: * The PDF is downloaded to some temporary directory where I won't have to worry about deleting it manually * In whatever tab the PDF is displayed in, the location bar contains the URL where the PDF was (temporarily!) downloaded from How can I achieve this? Not having the URL where a PDF was opened from is very annoying when, for example, I open a bunch of PDF search results to read and review, and I later want to share links to some of those PDFs. Best I can do to find their URLs to give to others is then to try and remember which tab corresponds to which search result, or do mine the downloads tab. Contrast this with Chrome: I click a Google result for a PDF and ''the PDF just opens in the current tab with the URL to the PDF in the location bar''. No dialogs, no PDF files hanging around in my home directory, and I can just copy the URL to the PDF the same way I'd copy the URL to any web page. Thank you!

被采纳的解决方案

Sigh. It appears the problem was one or both of the following preferences:

  • pdfjs.enabledCache.state: false
  • pdfjs.migrationVersion: 2

I deleted both, and now clicking on a PDF just opens in the sane, normal way in Firefox that I desire.

Naturally I have no idea how those got set.

定位到答案原位置 👍 0

所有回复 (4)

more options

选择的解决方案

Sigh. It appears the problem was one or both of the following preferences:

  • pdfjs.enabledCache.state: false
  • pdfjs.migrationVersion: 2

I deleted both, and now clicking on a PDF just opens in the sane, normal way in Firefox that I desire.

Naturally I have no idea how those got set.

more options

Note that this is supposed to happen if you use "Open in Firefox" to open a PDF in Firefox instead of saving the file or open the file in an external application (PDF viewer). This causes the file to get downloaded to the temp folder and the resulting file:// link to the file in the temp folder is opened in a Firefox tab. This still creates an history entry that has the URL where you downloaded this file, so you can check the history from around the time you looked at this file..

more options

cor-el said

Note that this is supposed to happen if you use "Open in Firefox" to open a PDF in Firefox instead of saving the file or open the file in an external application (PDF viewer).

Understood, thanks. After I deleted my pdfjs.enabledCache.state=false pref, I stopped even getting a dialog: clicking on links to PDFs where the server doesn't force download now just shows the PDF right in the tab, with the remote URL in the location bar, just like I expected. No more downloading.

more options

Firefox should open the PDF file in a tab if the server sends it as "application/pdf". If the file is send as a generic type like "application/octet-stream" or send as "content-disposition:attachment" then you get the choice in the download dialog to open the PDF file in Firefox. In case you choose the latter then you get the described behavior with getting a file:// link to a file in the temp folder.