Skip to content
Related Articles

Related Articles

HTML DOM TokenList supports() Method

View Discussion
Improve Article
Save Article
  • Last Updated : 12 Jul, 2022
View Discussion
Improve Article
Save Article

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. 

HTML




<!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=
    </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>

Output:

 

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!