Javascript 如何从后台关闭弹出窗口?
我知道我们可以使用弹出窗口中的Javascript 如何从后台关闭弹出窗口?,javascript,google-chrome-extension,Javascript,Google Chrome Extension,我知道我们可以使用弹出窗口中的window.close()关闭弹出窗口 但是,有没有办法在Chrome扩展中关闭背景页面的弹出窗口?可以使用: var windows = chrome.extension.getViews({type: "popup"}); if (windows.length) { windows[0].close(); // Normally, there shouldn't be more than 1 popup } else { console.log("T
window.close()
关闭弹出窗口
但是,有没有办法在Chrome扩展中关闭背景页面的弹出窗口?可以使用:
var windows = chrome.extension.getViews({type: "popup"});
if (windows.length) {
windows[0].close(); // Normally, there shouldn't be more than 1 popup
} else {
console.log("There was no popup to close");
}