-
chrome浏览器自带的按钮都可以支持快捷键操作,我们自己开发的插件如何增加快捷键支持呢
-
答案当然是在清单文件
manifest.json上搞事情,增加一个commands字段如下"commands": { "_execute_browser_action": { "suggested_key": { "default": "Ctrl+Shift+F", "mac": "MacCtrl+Shift+F" }, "description": "Opens hello.html" } }修改完后的完整内容如下
{ "name": "Hello Extensions", "description": "Base Level Extension", "version": "1.0", "manifest_version": 2, "browser_action": { "default_popup": "hello.html", "default_icon": "hello_extensions.png" }, "commands": { "_execute_browser_action": { "suggested_key": { "default": "Ctrl+Shift+F", "mac": "MacCtrl+Shift+F" }, "description": "Opens hello.html" } } } -
重新加载,测试一下快捷键吧