This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2018.
The supports() method of the DOMTokenList interface returns true if a given token is in the associated attribute's supported tokens. This method is intended to support feature detection.
supports(token)
tokenA string containing the token to query for.
A boolean value indicating whether the token was found.
const iframe = document.getElementById("display");
if (iframe.sandbox.supports("an-upcoming-feature")) {
// support code for mystery future feature
} else {
// fallback code
}
if (iframe.sandbox.supports("allow-scripts")) {
// instruct frame to run JavaScript
//
// (NOTE: This feature is well-supported; this is just an example!)
//
}
| Specification |
|---|
| DOM> # ref-for-dom-domtokenlist-supports①> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
supports |
49 | 17 | 49 | 36 | 10.1 | 49 | 49 | 36 | 10.3 | 5.0 | 49 | 10.3 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/supports