Listen for the user executing commands that you have registered using the commands manifest.json key.

Types

commands.Command
Object representing a command. This contains the information specified for the command in the commands manifest.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.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaFirefox for Android
CommandChrome Full support YesEdge No support NoFirefox Full support 48Opera Full support YesFirefox Android No support No
getAllChrome Full support YesEdge No support NoFirefox Full support 48Opera Full support YesFirefox Android No support No
onCommandChrome Full support YesEdge No support NoFirefox Full support 48
Notes
Full support 48
Notes
Notes Before version 63, the onCommand listener was not treated as a handler for a user action.
Opera Full support YesFirefox Android No support No
resetChrome No support NoEdge No support NoFirefox Full support 60Opera No support NoFirefox Android No support No
updateChrome No support NoEdge No support NoFirefox Full support 60Opera No support NoFirefox Android No support No

Legend

Full support  
Full support
No support  
No support
See implementation notes.
See implementation notes.

Example extensions

Acknowledgements

This API is based on Chromium's chrome.commands API.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

Contributors to this page: wbamberg, hellosct1, andrewtruongmoz
Last updated by: wbamberg,