[英]Chrome extension initiate browser_action popup from background scripts
I am trying to show a chrome extension popup from a trigger to shortcut keys like(ctrl+shift+U). 我正在尝试显示从触发器到快捷键之类的chrome扩展弹出窗口,例如(ctrl + shift + U)。
Manifest Json: 清单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."
}
Background script: 后台脚本:
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');
});
});
Is there any function that could trigger the same task that happens when we click on browser_action icon. 是否有任何功能可以触发与我们单击browser_action图标时发生的任务相同的任务。
This could be simple but new to chrome extensions and terminology, didn't find any good references for this kind of problem. 这可能很简单,但对于chrome扩展名和术语来说是新的,没有找到有关此类问题的良好参考。
Try adding "global": true
. 尝试添加
"global": true
。 Here's a reference for chrome commands: https://developer.chrome.com/extensions/commands 这是chrome命令的参考: https : //developer.chrome.com/extensions/commands
Actually found it, this in command section is used to trigger the chrome extension open from shortcut. 实际上在命令部分找到了它,用于触发从快捷方式打开的chrome扩展。
"_execute_browser_action": {
"suggested_key": {
"default": "Ctrl+Shift+K",
"mac": "Command+Shift+K"
}
It was a misunderstanding of terminologies. 这是对术语的误解。 Thanks.
谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.