Skip to content

Iframe cannot be opened in Firefox insecure context #221

Description

@chladnefazole

We are using this project in a Firefox/Chrome web extension. RasterizeHTML is included as a content script (ie. insecure context).

PROBLEM: Firefox is blocking Rasterize from opening an iFrame in the insecure context. Basically, all actions on the iframe.contentDocument are banned: open, write, close, etc.

I fixed the problem locally by changing the following:

iframe.contentDocument.open()
...
iframe.contentDocument.write("<!DOCTYPE html>");
iframe.contentDocument.write(html);
iframe.contentDocument.close();

to:
iframe.srcdoc = `<!DOCTYPE html>${html}`;

We cannot use Rasterize from the extension's background scripts (ie. from a secure context) because in Chrome manifest V3, background scripts will not have access to the DOM.

Would it be possible for someone at Rasterize to address this issue, so that we can use your CDN directly with no security errors in FF insecure context?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions