HTML DOM Meta httpEquiv Property

The HTML DOM Meta httpEquiv Property is used to set or return the HTTP header for the information in the content attribute. The HTML http-equiv Attribute is used to provide header information or value of the content Attribute. It can be used to simulate an HTTP Header response. 

Syntax:

  • It returns the httpEquiv property:
metaObject.httpEquiv 
  • It is used to Set the httpEquiv property:
metaObject.httpEquiv = HTTP-he 

Property values:

  • content-type It Specifies the character set for the contents of the document.
  • default-style It Specified the preferred style sheet to use.
  • refresh It Defines a time interval for the document to refresh itself.

Examples: In this example, we will see the use of DOM Meta httpEquiv Property.

HTML




<!DOCTYPE html>
<html>
   
<head>
    <meta http-equiv="refresh"
          content="30">
</head>
   
<body>
    <h1>w3wiki</h1>
    <h2>DOM Meta http-equiv Property</h2>
    <p>Hello w3wiki!</p>
    <button onclick="myBeginner()">
        Submit
      </button>
    <p id="sudo"></p>
   
    <script>
        function myBeginner() {
            let x = document.getElementsByTagName(
                    "META")[0].httpEquiv;
            document.getElementById(
                "sudo").innerHTML = x;
        }
    </script>
</body>
   
</html>


Output: 

 

Supported Browsers: The browsers supported by DOM Meta httpEquiv Property are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera