chrome.webRequest.onBeforeRequest.addListener( async (details) => { console.log( 'onBeforeRequest MAIN_FRAME:', details.url, details.type, details.frameId, details.tabId, ) if ( details.url === 'https://monster-siren.hypergryph.com/manifest.json' && details.type === 'other' && details.frameId === 0 ) { const pref = await chrome.storage.sync.get('preferences') console.log(pref.preferences.autoRedirect) if (pref === undefined || pref.preferences === undefined || pref.preferences.autoRedirect === undefined || pref.preferences.autoRedirect === true) { chrome.tabs.create({ url: chrome.runtime.getURL('index.html') }) chrome.tabs.remove(details.tabId) } } }, { urls: ['https://monster-siren.hypergryph.com/manifest.json'] }, )