Meta tags:

Meta tags

The Meta tags are included in the head section  of the document and are not rendered as visible  text in the document, they are used to pass information and commands to the client browser.
Meta tags contain meta  information for the document.
Meta information  is about the document itself, instead of information that is about the contents of the document.
The amount of information that can be specified via the Meta tags  is very extensive, for instance the HTTP header  information can be replaced  or supplied via the http-equiv parameter  in the Meta tag.
For instance the Meta tag  in the example below defines the content of the document as html with the Latin character set (ISO-8859-1):

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

The Meta tags  can also control some aspects of the way the client browser handles the document, such as the length of time that the document should be cached by the browser, or not cached by the browser at all.
Perhaps you want to redirect the user to another page, maybe after a short delay for some reason and inform them of some information like a change of URL for instance.
In the example below the two Meta tags  tell the browser not to cache the page (pragma,no-cache) and then to refresh the browsers window  with a new document/web page after a short delay of 3 seconds (refresh).

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="refresh" content="3; url=" />

The Meta tags are also used to provide search engines with information, always include at least a minimum amount of information.
The most important  are a description of the document and keywords relating to the documents contents, then search engines  can at least categorize the documents correctly.
These keywords and the description will then be used by search engines,  when the search engine  returns the results of a seach it will list all keywords and the description from the Meta tags  in the document.
The example below shows how the description  and the keyword  Meta tags  for the index page of this web site could look.

<meta name="description" content="TheSandbox web site,test site for html
css documents on the WWW World Wide Web" />
<meta name="keywords" content="sandbox,sand,box,test site,test
Web,developement,design" />
Download the meta redirect example.
Download the meta redirect example
Download the source code in a text file.
Download the source code in a text file

As I mentioned earlier Meta tags  can be used to redirect the browser to a new page or just refresh the page and the documents content, or you may not want the document to be cached at all.
A good example of using this technique would be if you have moved the web site or certain pages, then you could redirect the user to the new location,  after short delay giving enough time to read a message on the page informing them of what is happening like this example.
When a document needs to be refreshed or redirected, then use the http-equiv "refresh" option in the Meta tag, which has the following form, shown in the example below.

<meta http-equiv="refresh" content="seconds_to_wait; url" />

It is a good idea to use the pragma no cache Meta tag along with the refresh tag,  this stops the browser form caching the document and then displaying the cached document instead of the refreshed/updated document.
Unfortunately because browsers treat the no cache differently you can used an expires Meta tag,  this then causes the document not to be cached at all, simply because it immediately expires in the cache, as show in the example below below.

<meta http-equiv="expires" content=-"0" />

The screen shot below illustrates the meta tags  that are used on the index page of this web site.

Screenshot of the meta tags on the index page of this web site

You can find more information on the W3CSchools web site about Meta Tags
A comprehensive list of HTTP 1.1 headers, and the HTTP 1.1 definition  can be found here
at the W3C web site.

Now we have looked at meta tags we can move on and look at how to populate a document with content and the tags we need to employ for this task block level tags.

Top of page
Valid XHTML1.0 Transitional. Valid CSS. Copyright © 2005 –