I am trying to create a chrome extension that runs some javascript code on the chrome error page that has the running dinosaur mini-game. I am getting a permission error when trying to run executeScript on the tab.
Here is my code:
manifest.js
{
"manifest_version": 2,
"name": "Extension Name",
"description": "desc",
"version": "1.0",
"background": {
"scripts": ["script.js"]
},
"permissions": [
"tabs",
"webNavigation",
"<all_urls>"
]
}
script.js
chrome.webNavigation.onErrorOccurred.addListener(function (data) {
if (data.error === "net::ERR_INTERNET_DISCONNECTED") {
this.chrome.tabs.executeScript(data.tabId, {
file: "execScript.js"
});
}
});
When I open a tab, and throttle the connection to offline using developer tools, I am redirected to the dinosaur page, but the extension complains that i must request permission to access that page:
Unchecked runtime.lastError while running tabs.executeScript:
Cannot access contents of url "data:text/html,chromewebdata".
Extension manifest must request permission to access this host.
at chrome-extension://jkjcmlcanhdodmlceikkfdklibkediio/script.js:9:26
If i try to add "data:text/html,chromewebdata"
to the manifest file, it will break the extension saying that the url is invalid.
Is there a way to add a permission for that url? Is there another way to run my script on the dinosaur page?