The purpose of HTML (Hyper Text Markup Language) is to enable web authors to specify structural information about their pages. Example:- images, tables, paragraphs etc. It also provides a way of adding information about the page and its content. Such type of information is known as metadata. It is added through the use of the <META> tag. The tag can also used to create the equivalent of HTTP (Hyper Text Transfer Protocol)headers, which provides instruction to the browser.
Use of Meta tag to provide information.
Meta tags should be placed within the <HEAD> section of your web pages. When we use META tag to provide information about our page, the basic syntax is below given.
<META NAME="dataname" CONTENT="datavalue">
In above syntax, "dataname" is a specific identifier for the information we are providing. The browser looks at this name and then it takes decision that how to treat the data. The information itself represented by "datavalue".
Description of Meta tags.
Here is the simple basically described pages content. Search engines often use it to display a brief page in summary results. Example is given below
<META NAME="description" CONTENT="An article about metadata and the META tag.">
Another self explanatory one, this is usually used to display the name of the person who wrote or designed the page’s content.
<META NAME="author" CONTENT="Sanjan Bikram">
This is metadata that usually everyone's talk about, although in reality its effectiveness is overhyped. The keywords allows you to identify a number of themed words and phrases which may be associated with tat web page in some particular way. Example:- Most of the keywords are associated with this articles might be: META tags, META data, HTTP, HTML etc.
While we search something in search engine, we mostly type few words or phrase whatever we are looking for. Search engine looks for the matches that we have entered within the web pages or stored in its database. That's why people have been going nuts over the META keywords tag, they think that if you don’t have it on each page, and don’t have an extensive list of words, then you won't get very good search engine results.
There are only three major search engines who gives the importance to META tags those are as follows.
The others base their results upon a page's actual content. However it is still worth adding META keywords to our pages if we want good results in those engines. Words and phrases are treated differently. For example, you would need to include the phrase "web authoring" as well as the two individual words "web" and "authoring" for best results. Here is the example:
<META NAME="keywords" CONTENT="metadata, META tag, meta, keywords, search engines">
Robot.txt is also related with search engines. Robot is a program which will visit a web page, index it somewhere, and then visit all the hyperlinks in that page, indexing them all. It may continue in this fashion indefinitely or it may stop after it has reached a certain level. Search engines often send a robot round to our website in order to add all its pages to their database.
Sometimes we may not want certain pages on our site to appear in search engine. Those may be pages containing sensitive information, or those which should not be viewed outside of frameset. We can use the meta tag to provide instruction to robots visiting a page. We can tell them not to index the page, or not to allow any of the links on it or both.
Below are the examples of some of the combinations that we can use:
<META NAME="robots" CONTENT="NOINDEX,NOFOLLOW">
<META NAME="robots" CONTENT="NOINDEX,FOLLOW">
<META NAME="robots" CONTENT="INDEX,NOFOLLOW">
<META NAME="robots" CONTENT="INDEX,FOLLOW">
Last line in this list is in fact the default setting. So we wouldn't ever need to use it in practice.
Use of META tags for controlling the web browser
Above I have described that META tag can also be used to generate the equivalent of HTTP headers. In practice, this means you can control the behavior of the user's browser.
Preventing a page from being cached
There may be occasions when we want to prevent a page from being cached locally on the user's computer and thus force the browser to load a fresh copy each time. Example: webcam while is automatically updated every few seconds. If the user visited at a later date the browser might show them the cached (outdated) version.
There are in fact three META tag verities which we should use to cause this behavior. This is because they are accepted in different browsers. The first expires is actually supposed to identify an expiry date for the web page. If we leave the value as 0, then it treats it as "now", therefore asks for a new version of the page every time. The other two, Pragma and Cache control, are specifically designed to prevent or control caching, and should take a value of "no-cache". So, to prevent our page being cached in most browsers, we should use the given lines.
<META HTTP-EQUIV="Expires" CONTENT="0">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
Incidentally, if we wish for our page to expire at later date, we can specify the date in the given format using GMT time:
<META HTTP-EQUIV="Expires" CONTENT="Tue, 05 May 2010 10:05:00 GMT">
Redirecting the browser to another URL
Currently web hosting services are becoming cheaper and cheaper, many webmasters have decided to change their location of websites from free ISP space to professional server space. This relocation obviously causes confusion because visitors to the site will try to use the old URL. What many people do is keep on page at the old address which, when visited, will automatically send the user on the site's new home. This can be easily achieved using the META tag, which will redirect the user either instantly or after a given time delays.
Example is given below, this tag will redirect the visitor to " http://www.sanbik.co.cc" after 15 seconds, giving them enough time to read about what's going on.
<META HTTP-EQUIV="Refresh" CONTENT="15;URL=http://www.sanbik.co.cc">
META tags can be very useful additions to our web pages, especially if we would like more control over how the search engines treat our site. Although the keywords and description tags are the most well known, the other forms of metadata can also prove to be helpful.