My extension stops working if the site is not available. I made two pictures using YouTube as an example:
My backround.js code:
var url = window.location.toString();
console.log(url); //chrome-error://chromewebdata/
if((url=="chrome-error://chromewebdata/") || (url=="https://www.youtube.com/")){
console.log("This site can’t be reached");
}
When access is blocked, the var url retrieves another link(chrome-error://chromewebdata/). I made a code to work on it but it didn't help.
How can I get the extension to work on such sites?