I need do something on tabs updated, like check if the page load correct, and replace something inside the page. here is my code
// background.js
chrome.tabs.onUpdate.addListener(function(tabId, changeInfo, tab){
try{
chrome.tabs.executeScript(tabId, filename);
} catch(e) {
// 1. when I open a new tab
// 1. Error during tabs.executeScript: Unknown error.
// 2. when I request a url not arrive-able.
// 2. Error during tabs.executeScript: Cannot access contents of url
// "data:text/html,chromewebdata". Extension manifest must request
// permission to access this host.
// but I can't catch these errors, they just appers in background console.
}
});
I try to executeScript when it upload, but if the current tab is chrome://newtab or chrome error page, I can't do this, but I can't catch the error.