DOM - DOMImplementation Object Method - hasFeature



The method hasFeature () tests if the DOM implementation implements a specific feature and version as defined in DOM Features.

Syntax

Following is the syntax of the hasFeature () method.

flag = document.implementation.hasFeature(feature, version);
S.No. Parameter & Description
1

feature

It is a DOMString representing the feature name.

2

version

It is a DOMString representing the version of the specification defining the feature.

Example

Following example demonstrates the usage of the hasFeature () method −

<!DOCTYPE html>
<html>
   <body>
      <script>
         document.write(document.implementation.hasFeature('Core', '3.0'));
      </script>
   </body>
</html>

Execution

Save this file as domimplementation_hasfeature.htm on the server path. We will get the output as shown below −

true
dom_domimplementation_object.htm
Advertisements