javascript - 关闭 chrome.runtime.openOptionsPage 的等效命令是什么?
问题描述
在 Chrome 扩展中,接近 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
解决方案
推荐阅读
- extjs - ExtJS 中基于 store 的卡片列表
- java - 从键盘事件中捕获日文字母
- java - 运行时的动态表达式求值器
- python - 使用 Affinity Propagation 对相似文本进行聚类并创建聚类图
- java - 在分布式应用程序中锁定表行,在 mysql 5.6 中运行 select..for update 时整个表被锁定
- reactjs - 从下拉列表中选择一个项目并在 React ES6 的另一个组件中使用该值
- c# - 映射到不同的类文件助手很慢
- php - PHP PDO 将字符串转换为 MS SQL datetime2
- php - 错误的ajax响应
- php - Woocommerce:当购物车中已有商品时,更改“添加到购物车”按钮颜色