Search w3schools.com:

SHARE THIS PAGE

Meta content Property

Meta Object Reference Meta Object

Definition and Usage

The content property sets or returns the value of the content attribute of a meta element.

The content attribute specifies the content of the meta information.

Note: The available values of this property depends on the value of the name and the httpEquiv properties.

Syntax

Set the content property:

linkObject.content="text"

Return the content property:

linkObject.content


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The content property is supported in all major browsers.


Example

Example

Display the value of the content attribute of all meta elements:

<html>
<head>
<meta name="keywords" content="HTML, DHTML, CSS, XHTML, JavaScript">
<meta name="description" content="Free Web tutorials">
<meta name="author" content="Hege Refsnes">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">

<script>
function displayResult()
{
var x=document.getElementsByTagName("meta");
var txt="";
for (var i=0;i<x.length;i++)
{
txt=txt+"Content of "+(i+1)+". meta tag: "+x[i].content+"<br>";
}
document.getElementById("result").innerHTML=txt;
}
</script>

</head>
<body>

<button type="button" onclick="displayResult()">Display Meta Content</button>

<p id="result"></p>

</body>
</html>

Try it yourself »


Meta Object Reference Meta Object

W3Schools Certification

W3Schools' Online Certification

The perfect solution for professionals who need to balance work, family, and career building.

More than 10 000 certificates already issued!

Get Your Certificate »

The HTML Certificate documents your knowledge of HTML.

The HTML5 Certificate documents your knowledge of advanced HTML5.

The CSS Certificate documents your knowledge of advanced CSS.

The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.

The jQuery Certificate documents your knowledge of jQuery.

The XML Certificate documents your knowledge of XML, XML DOM and XSLT.

The ASP Certificate documents your knowledge of ASP, SQL, and ADO.

The PHP Certificate documents your knowledge of PHP and SQL (MySQL).

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]