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.