An article by Fabry19dice
Redirecting Your Visitors
Want a way to automatically redirect your visitors to a new location? It's easier than you think if you use the META tag.
META tags are a powerful but often poorly understand part of HTML. The tag was created to allow webmasters to specify important "meta data" about their document. What's meta data? Literally, it's data about data. A META tag contains information about your overall Web page that's important for indexing, archiving, or otherwise managing the page. Think of it as the librarian's favorite tag.
By far the most frequent use of META tags is to help search engines index your page. By using a META tag with keywords or a document description, you can dramatically boost your ranking in the major search engines. Description and keyword versions of the META tag look like this:
<META NAME="Description" CONTENT="NetMechanic will tune your Web site!">
<META NAME="Keywords" CONTENT="link checker html validation">
But the META tag can have other uses as well. One of the most powerful of these is to automatically redirect your visitors to a different page. This can come in handy when:
You change the domain name or location of your Web site.
You change the structure of your site.
For example, suppose you rearrange your Web site so that the files are better organized on your server. Then you run Link Check and find that you have a broken link. Instead of fixing the broken link in every file in the site, it might be easier to put a redirect page in the old location so that visitors are forwarded to the new file. That's especially true if visitors may have set a bookmark to the old page.
To do this, you'll need to use the META tag's HTTP-EQUIV and CONTENT attributes. The HTTP-EQUIV attribute tells the browser that this page should redirect the visitor to another page; the CONTENT attribute tells the browser where it should go to find the new page.
The HTTP-EQUIV attribute can be used for several different purposes. The attribute was originally developed as a way to let Web page authors have more control over the HTTP response headers used by their Web server. HTTP response headers are part of the dialogue between your Web server and the visiting browser. The HTTP-EQUIV attribute was intended to let you name an HTTP header, assign a value to that header, and let that value override the server's normal response. In practice, though, not all Web servers support this and many webmasters report problems when the attribute is used this way.
The HTTP-EQUIV attribute can also be used by the Web browser, which is how we'll use it for redirecting visitors. To use it for redirection, its value should be set to HTTP-EQUIV="refresh".
Next we need to set the value of the CONTENT attribute. Be careful here, because the structure of the CONTENT attribute is unusual. It should contain two parts separated by a semi-colon. These parts are:
The number of seconds to wait before redirecting the visitor
The URL to which the visitor should be sent.
For example, the META tag below redirects the visitor to our home page after 10 seconds:
<!-- Send users to the new location. -->
This page has moved. You will be
to its new location in 10 seconds.
If you aren't forwarded
to the new page,
Since META tags aren't displayed by the browser, this tag should be put inside the HEAD section of your page. If the META tag is place inside the document BODY, it may not work correctly.
You may also want to link to the new page in the body of the document, since a few browsers don't support the META HTTP-EQUIV. For example, the UNIX browser Lynx doesn't support the tag.
There's a downside to doing this though: it makes the redirection noticeable to your visitors. If the body of the document contains any visible text, that text will be displayed before the redirect occurs. As a result, many webmasters prefer to leave the body of the page blank so as to make the redirect invisible. That's a decision you'll have to make based on the types of browsers coming to your site.
Se volete seguire i post di www.informarea.it potete iscrivervi al suo feed RSS.
I Vostri commenti sono benvenuti!
Non esitate a lasciare le Vostre impressioni o a porre domande.