How to detect that iframe violates CSP

433 views Asked by At

I'm working on an extension, which in injects an iframe with local content to a page. In Chrome it works fine, extensions there are not subjects to Content Security policy.

However it is a problem with some pages in Safari. Therefore I need a way to detect, when the iframe hasn't been injected properly.

Problem is that iframe itself is always inserted (using appendChild method), but it's content is not. Even the .src attribute remains OK. It seems that iframe.onload = ... could do that, but I'd prefer a synchronous call.

Once again, I need a way to either detect CSP violation before the frame was loaded (so no error message is printed), or detect the violation after the insertion itself.

Thanks.

0

There are 0 answers