我尝试在我的webextension中有一个像Ctrl + Shift + 0这样的快捷方式,但它不起作用!
manifest.json:
{
"name": "Sample Commands Extension",
"description": "Press Ctrl+Shift+U to send an event (Command+Shift+U on a Mac).",
"manifest_version": 2,
"version": "1.0",
"commands": {
"toto": {
"suggested_key": {"default": "Ctrl+Shift+0" } ,
"description": "Send a 'toggle-feature' event to the extension"
}
},
"background": {
"scripts": ["ts.js"]
}
}
和(文件.js):
browser.commands.onCommand.addListener(function(command) {
if (command == "toto") {
console.log("toggling the feature!");
document.body.style.border = "5px solid red";
}
});
但没有任何事情发生!
当它不是捷径时它起作用。什么东西挡住了捷径?