I am trying to make a chrome extension that reloads the page if the site cannot be reached. I know the site reload command, but I am not able to figure out the code for it. Can you please help me out here?
Use webNavigation API in the background script.
background.js:
chrome.webNavigation.onErrorOccurred.addListener(info => {
if (!info.frameId && info.error === 'net::ERR_NAME_NOT_RESOLVED') {
chrome.tabs.reload(info.tabId);
}
});