Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

Unable to download PDFs in embedded pdf.js viewer

more options

Example Site: https://mcpsc.mo.gov/media/pdf/genesis-school-inc-revocation-hearing but I've had it happen on several sites.

On this page, I am not able to click the download button built into the pdf.js viewer and have it download - it clicks and does nothing. If I right click in the frame and click "Show only this frame", then I can download the PDF using that same button. Any ideas?

Example Site: https://mcpsc.mo.gov/media/pdf/genesis-school-inc-revocation-hearing but I've had it happen on several sites. On this page, I am not able to click the download button built into the pdf.js viewer and have it download - it clicks and does nothing. If I right click in the frame and click "Show only this frame", then I can download the PDF using that same button. Any ideas?

被選擇的解決方法

Great workaround!

The family resemblance is because both the website and Firefox use code from the pdf.js PDF viewer project. There are a couple tells that the PDF is displaying in a website's custom viewer:

  • The magnifying glass at the left end of the viewer toolbar opens a custom Find bar instead of Firefox's Find bar
  • There is a button to upload your own PDF into the viewer
  • The button selection and style do not match the changes in recent versions of Firefox

The reason the download button doesn't work in the framed viewer is that the site serves the download as a blob URL and the page's security settings don't allow it to load in a frame (this appears in the Web Console -- Ctrl+Shift+K -- after clicking the button):

"Content Security Policy: The page’s settings blocked the loading of a resource at blob:https://mcpsc . mo . gov/aafe5ab0-48db-462f-92a2-66a6d6eb065f (“frame-src”)."

The site could adjust its CSP rules to allow the download to load into the frame. Or maybe it would make more sense if they directed the download to a new tab as a workaround.

從原來的回覆中察看解決方案 👍 1

所有回覆 (1)

more options

選擇的解決方法

Great workaround!

The family resemblance is because both the website and Firefox use code from the pdf.js PDF viewer project. There are a couple tells that the PDF is displaying in a website's custom viewer:

  • The magnifying glass at the left end of the viewer toolbar opens a custom Find bar instead of Firefox's Find bar
  • There is a button to upload your own PDF into the viewer
  • The button selection and style do not match the changes in recent versions of Firefox

The reason the download button doesn't work in the framed viewer is that the site serves the download as a blob URL and the page's security settings don't allow it to load in a frame (this appears in the Web Console -- Ctrl+Shift+K -- after clicking the button):

"Content Security Policy: The page’s settings blocked the loading of a resource at blob:https://mcpsc . mo . gov/aafe5ab0-48db-462f-92a2-66a6d6eb065f (“frame-src”)."

The site could adjust its CSP rules to allow the download to load into the frame. Or maybe it would make more sense if they directed the download to a new tab as a workaround.