Meta contentProperty
Meta Object
Definition and Usage
The content property sets or returns the value of the content attribute of a meta element.
The content property specifies the content of the meta information.
Note:The available values for this attribute depend on thenameandhttpEquivvalue of the attribute.
Syntax
Set the content property:
linkObject.content="text"
Return the content property:
linkObject.content
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the content property.
Example
Example
Display the content values of all meta attributes:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<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>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<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 Other Extensions