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!)
//
}