how to restore focus on existing chrome extension windows, instead of creating a new one?

Viewed 20

Im developing a chrome extension which open in a new windows using this code in background.js.

chrome.action.onClicked.addListener(function(tab) {
    chrome.windows.create({
        // Just use the full URL if you need to open an external page
        url: chrome.runtime.getURL("popup.html"),
        type: "popup",
        width: 250,
        height: 250,
    });
});

i want when user click on extension icon, and already there is an open extension windows, instead of creating a new window, restore the old one and im using manifest 3

1 Answers
Related