HTML - DOM Node isSupported() Method



The isSupported() method is used to check if a web browser can supports or handle a particular feature or functionality on a webpage.

The isSupported() method is outdated and not recommended for use.

Syntax

node.isSupported(feature, version)

Parameters

Parameter Description
feature specifies the name of the feature you want to check on a webpage.
Version it indicates the version of the feature.

Return Value

This method returns a boolean value:It returns 'true' if feature or functionality is supported;otherwise it returns 'false'.

Examples of HTML DOM Element 'isSameNode()' Method

Below are some examples of isSameNode() method, which shows how this method has been used previously.

Checking for onclick feature support

This examples shows how we can use the isSupport() method to check for specific feature whether it is supported by our browser or not.

<!DOCTYPE html>
<html lang="en">
<head> 
    <title>isSupported() Method Example</title>
</head>

<body>
    <h1>HTML - DOM Element</h1>
    <h2>isSupported() Method</h2>
    <p>
        Click the button below to check if the onclick
        feature is supported by your browser.
    </p>
    
    <div>
    <button onclick="checkSupport()">Check Support</button>
    </div>
    <p><b>Note</b>: onclick event is note working  on IE 
       and  chrome but it is working fine in firefox.
    </p>

    <script>
    function checkSupport() {
        // Feature to check (example: onclick attribute)
        var feature = 'onclick';

        if (document.body.isSupported && 
        document.body.isSupported(feature)) {
        alert('Feature "' + feature + '" is supported!');
        } else {
        alert('Feature "' +feature+'"is not supported.');
        }
    }
    </script>
</body>
 
</html>

Checking for clipboard feature support

This examples shows how to use the isSupport() method to check for specific feature whether it is supported by our browser or not.

<!DOCTYPE html>
<html lang="en">
<head> 
  <title>Checking for Feature Support</title>
</head>

<body>
  <h1>HTML - DOM Element</h1>
  <h2>isSupported() Method</h2>
  <p>
    Click the button below to check if the clipboard
    API feature is supported by your browser.
  </p>
  
  <div>
    <button onclick="checkSupport()">Check Support</button>
  </div>
  <p>
    <b>Note:</b>This feature is supported in 
    some browsers but not in older versions of others.
  </p>
  <script>
    function checkSupport() {
      var feature = 'clipboard';  
      if (document.body.isSupported && 
      document.body.isSupported(feature)) {
        alert('Feature "' + feature + '" is supported!');
      } else {
        alert('Feature "' + feature + '" is not supported.');
      }
    }
  </script>
</body>

</html>

Supported Browsers

Method Chrome Edge Firefox Safari Opera
isSupported() No No No No No
html_dom.htm
Advertisements