The supports() method in HTML DOM is used to check if a specific token is supported in a DOM TokenList.
Syntax:
domtokenlist.supports(token)Parameter values: It contains a single value token that specifies the name of the token which is to be checked.
Return value: It returns a boolean value that returns true if a specified token belongs to a DOM TokenList.
Example: Below HTML code illustrates the use of supports() method in HTML DOM.
<!DOCTYPE html>
<html>
<body style="text-align:center">
<h1 style="color: green;">
GeeksforGeeks
</h1>
<h2>HTML DOM TokenList supports() Method</h2>
<iframe id="iframeID" src=
"https://www.geeksforgeeks.org/community/">
</iframe>
<p>
Click on the below button if the
iframe supports "allow-forms":or not
</p>
<button onclick="btnclick()">
Click Here!
</button>
<p id="paraID" style="font-size:25px"></p>
<script>
function btnclick() {
const list = document.getElementById(
"iframeID").sandbox;
document.getElementById("paraID").innerHTML
= list.supports("allow-forms");
}
</script>
</body>
</html>
Supported Browsers:
- Google Chrome 49 and above
- Edge 17 and above
- Internet Explorer not supported
- Firefox 49 and above
- Safari 10.1 and above
- Opera 36 and above