CenterForOpenScience/modular-file-renderer

[FIX] PDF printing,add allow-modals attribute in iframe

ebijun opened this issue · 0 comments

In previewing PDF document,
OSF.io use PDF.js and pdf.worker.min.js,to Preview/Print file.
and Print button always failed with
"iframe sandbox parameter should contain "allow-modals" parameter."

Because In OSF,pdf.worker.min.js called in iframe tag,

<iframe name="result" sandbox="allow-forms allow-popups allow-scripts allow-same-origin" frameborder="0">

To fix Print button failure,add "allow-modals",in iframe tag,

<iframe name="result" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin" frameborder="0">

so please add allow-modals attribute,to Print button.tested and works well on NII environment.

https://github.com/CenterForOpenScience/modular-file-renderer/blob/develop/mfr/server/static/js/mfr.js#L82

self.pymParent.iframe.setAttribute('sandbox', 'allow-scripts allow-popups allow-same-origin');
to
self.pymParent.iframe.setAttribute('sandbox', 'allow-scripts allow-popups allow-same-origin allow-modals');