I'm creating a chrome extension to compliment my webapp. Long story short, it creates an iframe within a content-script that hosts a site I've created previously. The iframe is loaded locally with the chrome extension.
The reason it's an iframe is because as opposed to making a pop-up with a browser-action I am trying to make it look like panel/modal within gmail. Here's an example of what it looks like
Now to the actual issue, I'm trying to execute an action within the iframe that operates on the iframe's parent window. for example window.parent.someMethod()
. However every time I attempt that I get this error:
Uncaught DOMException: Blocked a frame with origin
"chrome-extension://dcihnokebmondckijoccdhbhcpkonfid" from accessing a
cross-origin frame.(anonymous function)
I know this has to do with the security baked into chrome-extensions and in attempt to alleviate the issue I've set my content_security_policy
inside the manifest to script-src 'self' 'unsafe-eval'; object-src 'self';
. This did not solve my issue.
In summary: I'm looking for a solution inside of the chrome extension api to allow my iframe to access it's parents window.