Listen for the user executing commands that you have registered using the commands manifest.json key.
On this page
commands
Types
-
commands.Command -
Object representing a command. This contains the information specified for the command in the
commandsmanifest.json key.
Functions
-
commands.getAll -
Gets all registered commands for this extension.
-
commands.reset -
Reset the given command's description and shortcut to the values given in the manifest key.
-
commands.update -
Change the description or shortcut for the given command.
Events
-
commands.onCommand -
Fired when a command is executed using its associated keyboard shortcut.
Example extensions
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
Command |
Yes | 79 | 48 | ? | Yes | 14 | ? | ? | No | ? | 15 | ? |
getAll |
Yes | 79 | 48 | ? | Yes | 14 | ? | ? | No | ? | 15 | ? |
onCommand |
Yes | 79 | ? | Yes | 14 | ? | ? | No | ? | 15 | ? | |
reset |
No | No | 60 | ? | No | No | ? | ? | No | ? | No | ? |
update |
No | No | 60 | ? | No | No | ? | ? | No | ? | No | ? |
Note:
This API is based on Chromium's chrome.commands API.
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/commands