google-chrome-extension - 在 Edge 上启用 page_action 图标但没有弹出窗口
问题描述
我无法让一个微不足道的 page_action 在 Edge 中工作。它变为活动状态,但不会像浏览器操作那样弹出弹出 html。
mainifest.json
{
"manifest_version" : 2,
"name": "Page action",
"version": "0.1",
"description": "Hello World",
"page_action": {
"default_icon": "icon16.png",
"default_title": "PageActioner",
"default_popup": "popup.html"
},
"background": {
"scripts": ["background.js"]
}
}
背景.js
console.log("This goes nowhere would be good to get working.");
chrome.tabs.query({currentWindow: true, active: false}, function(tabs) {
chrome.pageAction.show(tabs[0].id); // Colored in first tab, hacky but works
});
// This can work, but should not be needed and pops up in the wrong place
// let winUrl = chrome.extension.getURL("popup.html");
// chrome.pageAction.onClicked.addListener(function (tab) {
// let wd=window.open(winUrl, "_blank", width=500,height=200,left=1,top=1,location=1");
// });
会不会是权限问题?有没有办法在开发时说 all_permissions?(我正在从文件中加载它。)
此外,console.log() 似乎消失了,但警报似乎有效。
任何帮助表示赞赏。
解决方案
由于毫无意义的原因,这开始神奇地起作用。我将把它作为一个简单的 page_action 示例留在这里,它可能会对某人有所帮助。
推荐阅读
- c# - Linq:在实体框架核心中加入与包含/然后包含
- github - Github:如何复制公共 repo 并使其可更新和私有 VIA BROWSER
- javascript - 如何在外部 js 文件中使用点击事件监听器而不是内联
- java - 解析对复杂 DTO 的响应?
- javascript - Mongoose 按子条件查找文档
- java - How to Read a Large File Efficiently with Java/android
- mysql - Column that starts with AST and ends in only number
- python - Plotly Dash children= clause
- c# - C# Selenium 查找 XPath 时遇到问题
- javascript - 如何为我的 React 应用程序创建对计算机功能的游戏