I have a very simple background page for a Chrome extension:
chrome.runtime.onInstalled.addListener((reason) => {
console.log(reason);
});
The background page runs when my extension is loaded:
The extension also has a popup that runs getBackgroundPage(), using:
const serviceWorkerWindow = await chrome.runtime.getBackgroundPage();
This fails with:
Uncaught (in promise) Error: You do not have a background page.
How do I make getBackgroundPage()
work?