Document.queryCommandSupported()

La méthode Document.queryCommandSupported() indique si la commande d'éditeur spécifiée est prise en charge par le navigateur.

Syntaxe

js
isSupported = document.queryCommandSupported(command);

Paramètres

command

La commande pour laquelle on veut déterminer si elle est prise en charge.

Valeur de retour

Renvoie un Boolean qui est true (vrai) si la commande est prise en charge et false (faux) sinon.

Notes

La commande 'paste' (coller) renvoie false (faux), pas seulement si la fonctionnalité n'est pas disponible, mais également si le script l'appelant a des privilèges insuffisants pour réaliser l'action [1].

Exemple

js
var flg = document.queryCommandSupported("SelectAll");

if (flg) {
  // ...Faire quelque chose
}

Spécifications

No specification found

No specification data found for api.Document.queryCommandSupported.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Compatibilité des navigateurs

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
queryCommandSupported
DeprecatedNon-standard

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.
Has more compatibility info.

Voir aussi