我正在尝试显示从触发器到快捷键(如(ctrl+shift+U))的 Chrome 扩展弹出窗口。
list Json:
"commands": {
"generate_link": {
"suggested_key": {
"default": "Ctrl+K",
"mac": "Command+K"
},
"description": "Builds link copy to extension."
},
"show-interface": {
"suggested_key": {
"default": "Ctrl+Shift+K",
"mac": "Command+Shift+K"
},
"description": "Show builder interface2."
}
后台脚本:
chrome.commands.onCommand.addListener(function(command) {
chrome.tabs.update({}, function(tab) {
if (command == 'generate_link')
{
//need to show extension window with some info about the current tab
getLink(tablink)
}
else if (command == 'show-interface')
alert('show-interface');
});
});
是否有任何函数可以触发与我们单击 browser_action 图标时发生的相同任务。
这可能很简单,但对于 Chrome 扩展和术语来说是新的,没有找到针对此类问题的任何好的引用。
最佳答案
尝试添加"global": true
。以下是 chrome 命令的引用:https://developer.chrome.com/extensions/commands
关于javascript - Chrome 扩展程序从后台脚本启动 browser_action 弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25088698/