Link to home
Start Free TrialLog in
Avatar of pamboo
pamboo

asked on

Meta tag and Attributes

Explain The Attributes used like Name,Content,Generator etc; in a Detailed manner. (ie.With Examples).
Avatar of Vitenka
Vitenka

Whew! Tall order!

None of those tags actually do anything, with the exception of 'content-type'

<META NAME=Generator CONTENT="HTMLpad v1.1 (c) DRaX">
META - means this isn't really a tag, it's information about the document.
NAME=xxx means that xx is actually the tag (and that if the browser knows about xxx tags it should treat the line as if it read <XXX CONTENT=".....">

Now, the CONTENT field gives all the other attributes for the tag.

So, an example set of META tags might be...
      <META NAME="AUTHOR" CONTENT="Vitenka (Adam Brunning)">
      <META NAME="KEYWORDS" CONTENT="Animus Silvae, Animus">
      <META NAME="DESCRIPTION" CONTENT="Welcome to the...">
      <META HTTP-EQUIV="Refresh" CONTENT="5; URL=main.htm">

Now, the first three tags are, essentially, meaningless.
Some web cruising, or management, software might use them - but otherwise they are basically comments; and could proabably be written as such.
The 'Keywords' and 'description' contents are used by search engines (primarily) and should match the contents of the page - or they will be discarded.

Now for the interesting one.
HTTP-EQUIV means that the tag shopuld be parsed as though it had appeared in the HTTP header to the document; ie. the bit CGI manipulates, and which can contain froody information.
You can put redirect, content-type, title and other such information in there - but you probably shouldn't.
The useful one is that 'refresh' one - which is what allows a page to force load another, after a set time period.

The format is as given -
<META HTTP-EQUIV="Refresh" CONTENT="5; URL=main.htm">
Just 'Refresh' as the http header equivalent; the content should be the time (in seconds) before a refresh) and (optionally) a semicolon, and then the next URL to load.
If no URL is given, then the same page loads again.

K?

Vitenka...

About this refresh thing...

If i had a directory called directoryl and i didnt want people to see all the stuff in the directory (say if it where my scripts and stuff were), id put a page there called directory/index.html and in the header put

<META HTTP-EQUIV="Refresh" CONTENT="1, URL=/page.html">

where page.html is a page they are allowed to see in a directory they are allowed to access?

If so this is cool, because i was about to post the question about how to do that myself but i saw this one, an thought id read this first. Lucky i did!!


Thanx
Daniel
Avatar of pamboo

ASKER

well thank you.
Vitenka is correct in his description on the META tags with one important exception.

The Meta tags are designed not for the browsers use but the Web Servers. When a server receives a request for a document the web server will parse the head section of the page and for HTTP-EQUIV tags issue the appropriate HTTP header. It is this HTTP header that the browser uses not the content of the Meta tag.

According to the HTTP spec there is no requirement for a browser to understand the META tags.

Incidentally the refresh idea to avoid people seeing the contents of a directory will appear to work but is not the correct way of protecting a directory. To implement this you should turn directory indexing off for that directory and/or make the directory inaccessible to the server.


ASKER CERTIFIED SOLUTION
Avatar of neelam_s
neelam_s

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial