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!

搜索 | 用户支持

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

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.