The Document.queryCommandSupported()
method reports whether or not the specified editor command is supported by the browser.
isSupported = document.queryCommandSupported(command);
command
Returns a Boolean
which is true
if the command is supported and false
if the command isn't.
The 'paste'
command return false
not only if the feature is unavailable, but also if the script calling it has insufficient privileges to perform the action [1]
var flg = document.queryCommandSupported("SelectAll"); if(flg) { // ...Do something }
Specification | Status | Comment |
---|---|---|
HTML Editing APIs The definition of 'querycommandsupported' in that specification. | Editor's Draft | Initial definition |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 17 | Yes | 41
|
4 | ? | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | Yes | Yes | 41
|
? | ? | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/document/queryCommandSupported