You are here: Reference > JavaScript > client-side > HTML DOM > properties > content (meta)

content property (meta)

Browser support:
Sets or returns the meta information itself.
The available values of the content property are dependent on the value of the name and the httpEquiv properties.

Syntax:

object.content;
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: content

Possible values:

String that sets or retrieves the given type (specified by httpEquiv or name property) of information. The value of this property is dependent on the value of the httpEquiv and the name properties.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the content attribute:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Expires" content="Tue, 20 Aug 2020 14:25:27 GMT" />
    <meta name="Author" content="Dottoro" />
</head>
<body >
</body>
</html>
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the content property:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Expires" content="Tue, 20 Aug 2020 14:25:27 GMT" />
    <meta name="Author" content="Dave Raggett" />
    <script type="text/javascript">
        function GetContent () {
            var metaTags = document.getElementsByTagName ("meta");
            for (var i = 0; i < metaTags.length; i++) {
                alert ("The value of the content property in the " + (i+1) + ". meta tag: " + metaTags[i].content);
            }
        }
    </script>
</head>
<body >
    <button onclick="GetContent ();">Get contents!</button>
</body>
</html>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content