In my chrome extention, content script loads in wrong window, instead of loading in top level browser window, it loads in on of the iframes!
So, on https://www.google.com
tab, I want it to load in main window, but instead it is loading in Google products dropdown - an iframe with url, https://notifications.google.com
.
If I tried to access top level window using window.top
or window.parent
it is giving error as:
DOMException: Blocked a frame with origin "https://notifications.google.com" from accessing a cross-origin frame.
How can I make the content script to load in top level window?
My manifest.josn contanis:
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*", "<all_urls>"],
"match_about_blank": true,
"js": ["dist/contentScript.js"],
"run_at": "document_idle",
"all_frames": true
}
],