在 Chrome 扩展中,什么等同于 close to chrome.runtime.openOptionsPage?我试过了:
window.close();
和
chrome.runtime.closeOptionsPage();
这需要从选项页面本身调用。
更新
根据下面评论中的 wOxxOm,“window.close()”应该可以工作。所以这可能是我浏览器 Edge 中的一个错误。
wOxxOm 建议使用“chrome.tabs.remove”。但是,我在选项脚本中以这种方式使用它时出现错误:
chrome.tabs.getCurrent(function(tab) {
chrome.tabs.remove(tab.id, function() { });
});
Error handling response: TypeError: Cannot read property 'id' of undefined