7. Meta Tags of HTML

HTML Meta Tag

First of all,this article is about HTML meta tag.Furthermore it is essential.The META elements can be used to include name/value pairs describing properties of the HTML document, such as author, expiry date, a list of keywords, document author etc.In addition to complete HTML guide it is most noteworthy thing.
The <meta> tag is used to provide such additional information. This tag is an empty element and so does not have a closing tag but it carries information within its attributes.
You can include one or more meta tags in your document based on what information you want to keep in your document but in general, meta tags do not impact physical appearance of the document so from appearance point of view, it does not matter if you include them or not.It is especially relevant to html.

Adding Meta Tags to Your Documents


html meta tag

Specifying Keywords


You can use <meta> tag to specify important keywords related to the document and later these keywords are used by the search engines while indexing your web page for searching purpose.

Example

Following is an example, where we are adding HTML, Meta Tags, Metadata as important keywords about the document.(HTML meta tag)

<!DOCTYPE HTML>
<HTML>
<head>
<title>Meta Tags Example</title>
<meta name=”keywords” content=”HTML, Meta Tags, Metadata” />
</head>
<body>
<p>Hello HTML5!</p>
</body>
</HTML>

This will produce the following result:

Hello HTML5!

Document Description


You can use <meta> tag to give a short description about the document. This again can be used by various search engines while indexing your web page for searching purpose.

Example

<!DOCTYPE HTML>
<HTML>
<head>
<title>Meta Tags Example</title>
<meta name=”keywords” content=”HTML, Meta Tags, Metadata” />
<meta name=”description” content=”Learning about Meta Tags.” />
</head>
<body>
<p>Hello HTML5!</p>
</body>
</HTML>

Document Revision Date


You can use <meta> tag to give information about when last time the document was updated. This information can be used by various web browsers while refreshing your web page.

Example

<!DOCTYPE HTML>
<HTML>
<head>
<title>Meta Tags Example</title>
<meta name=”keywords” content=”HTML, Meta Tags, Metadata” />
<meta name=”description” content=”Learning about Meta Tags.” />
<meta name=”revised” content=”Tutorials point, 3/7/2014″ />
</head>
<body>
<p>Hello HTML5!</p>
</body>
</HTML>

Document Refreshing


A <meta> tag can be used to specify a duration after which your web page will keep refreshing automatically.

Example

<!DOCTYPE HTML>
<HTML>
<head>
<title>Meta Tags Example</title>
<meta name=”keywords” content=”HTML, Meta Tags, Metadata” />
<meta name=”description” content=”Learning about Meta Tags.” />
<meta name=”revised” content=”Tutorialspoint, 3/7/2014″ />
<meta http-equiv=”refresh” content=”5″ />
</head>
<body>
<p>Hello HTML5!</p>
</body>
</HTML>

Page Redirection


You can use <meta> tag to redirect your page to any other web page. You can also specify a duration if you want to redirect the page after a certain number of seconds.

Example

<!DOCTYPE HTML>
<HTML>
<head>
<title>Meta Tags Example</title>
<meta name=”keywords” content=”HTML, Meta Tags, Metadata” />
<meta name=”description” content=”Learning about Meta Tags.” />
<meta name=”revised” content=”Tutorials point, 3/7/2014″ />
<meta HTTP-equiv=”refresh” content=”5; url=http://www.tutorialspoint.com” />
</head>
<body>
<p>Hello HTML5!</p>
</body>
</HTML>

Setting Cookies


Cookies are data, stored in small text files on your computer and it is exchanged between web browser and web server to keep track of various information based on your web application need.
You can use <meta> tag to store cookies on client side and later this information can be used by the Web Server to track a site visitor.

Example

Following is an example of redirecting current page to another page after 5 seconds. If you want to redirect page immediately then do not specify content attribute.

If you do not include the expiration date and time, the cookie is considered a session cookie and will be deleted when the user exits the browser.
Note: You can check PHP and Cookies tutorial for a complete detail on Cookies.

 

To know more about html meta tag please visit here

Leave a Reply

Your email address will not be published. Required fields are marked *