Skip to content

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

@ebijun

Description

@ebijun

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');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions