The Document.queryCommandSupported()
method reports whether or not the specified editor command is supported by the browser.
SyntaxEdit
isSupported = document.queryCommandSupported(command);
-
Parameters
command
- The command for which to determine support.
Return value
Returns a Boolean
which is true
if the command is supported and false
if the command isn't.
NotesEdit
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]
ExampleEdit
var flg = document.queryCommandSupported("SelectAll");
if(flg) {
// ...Do something
}
SpecificationsEdit
Specification | Status | Comment |
---|---|---|
HTML Editing APIs The definition of 'querycommandsupported' in that specification. |
Editor's Draft | Initial definition |
Browser compatibilityEdit
[1] Before Firefox 41, for the command 'paste'
Firefox incorrectly returned true
when the paste feature was available but the calling script had insufficient privileges to actually perform the action.
See alsoEdit
Document Tags and Contributors
Tags:
Contributors to this page:
Potappo,
teoli,
hallvors,
Sebastianz,
Dan-Dascalescu,
znap026,
MHasan,
mnoorenberghe,
kscarfone,
gurdev_singh,
ethertank,
Sheppy
Last updated by:
Potappo,