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!

Sykje yn Support

Mij stipescams. Wy sille jo nea freegje in telefoannûmer te beljen, der in sms nei ta te stjoeren of persoanlike gegevens te dielen. Meld fertochte aktiviteit mei de opsje ‘Misbrûk melde’.

Learn More

Dizze konversaasje is argivearre. Stel in nije fraach as jo help nedich hawwe.

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?

Keazen oplossing

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.

Dit antwurd yn kontekst lêze 👍 1

Alle antwurden (1)

more options

Keazen oplossing

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.