我无法让一个简单的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"]
}
}background.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()似乎消失了,但警报似乎起作用了。
感谢您的帮助。
发布于 2021-06-16 15:23:11
出于一些莫名其妙的原因,它开始神奇地发挥作用。我将把它作为一个可能对某些人有帮助的简单的page_action示例留在这里。
https://stackoverflow.com/questions/67998065
复制相似问题