【发布时间】:2014-08-02 05:54:36
【问题描述】:
我正在尝试显示从触发器到快捷键(如(ctrl+shift+U))的 chrome 扩展弹出窗口。
清单 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 扩展和术语来说是新的,没有找到解决此类问题的任何好的参考。
【问题讨论】:
标签: javascript google-chrome google-chrome-extension