Well, the most I could do was send a new XHR request to this URL and check the returned status. For invalid domains, the status seems to be 0 , for 404 pages it is 404 .
background.html
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { if(changeInfo.status == "loading") { var xhr = new XMLHttpRequest(); xhr.open("GET", tab.url, true); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if(xhr.status == 0) { console.log("wrong domain:", tab.url); } else if(xhr.status == 404) { console.log("404 page:", tab.url); } else if(xhr.status == 200) { console.log("regular page:", tab.url); } } } xhr.send(); } });
source share