W3Schools.com

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 type="text/javascript">
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
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE