[Source Index] | [Feedback]
|
With the possible exception of "How do I put sound on my page?", this is the most frequently asked of all frequently asked questions. We've all seen it done, and, when it works, it seems to impress quite a few people. The concept is called Client Pull, and the code is actually very simple. There are some things to consider when using this technique.
I'll cover the particulars behind these considerations shortly, but first, let's look at the HTML that does it.
<META HTTP-EQUIV="Refresh" CONTENT="5; URL=http://www.yadda.com/path/file.html">
This is the typical redirect line of HTML. the 5 is the number of seconds (after the page loads including graphics) that the HTML client (browser) will wait before making a request for the file http://www.yadda.com/path/file.html. The URL can be either an absolute or relative URL. That is, if you wrote the above in the HTML file http://www.yadda.com/path/index.html you could shorten the code by putting simply URL=file.html.
The above example makes use of the META element and, therefore, needs to be placed inside a <HEAD>...</HEAD> section.
Should it go before or after the TITLE?
In general, this doesn't matter. However, since most search engines do give a special importance to both the TITLE and the first few lines of a document (usually somewhere in the neighborhood of 250 characters), it is probably wisest to put the META refresh after the TITLE and any META keywords, content labelling, or description tags.
How about just refreshing the same page?
That's even simpler:
<META HTTP-EQUIV="Refresh" CONTENT="5">
1. It's usually unnecessary
I can think of only two legitimate uses for client pull. First, to redirect visitors to a new location when a page has moved. Second, to implement an automatic bulletin-board style chat. The second one is a gray area to me, since those types of chat depend on a sophisticated server set-up that would indicate the ability to use server push instead (which i won't go into here). The first use barely justifies the entire practice of client pull.
Most of the times I've seen client pull in action, however, it has been to do nothing more than impress visitors. "Wow, see what I can do?" This is fine for a personal home-page, but, even there, the use of client pull is often done thoughtlessly as well as being unnecessary.
2. It only works in a limited number of browsers
True, those browsers are the most popular ones and are used by the majority of people. I have seen sites, however that offer no visible way to get past the front page other than be pulled to the next page. In an HTML client that doesn't support client pull, this means you have reached a dead end. This is what I mean by doing it thoughtlessly. Also, some of the most important visitors to your pages will be bots from the search engines. These bots are just automated link followers. If there is no link, nothing but this dead-end front page gets indexed. So, in one step, this method both narrows your audience and limits your exposure.
3. It can be a pain to work with
The most common way of developing a site is to test it locally on an HTML editor and a browser -- test and tune and repeat. When using client pull, this become more difficult than it needs to be.
First, you are pulled to the second page, so you only have a limited amount of time to look at your work in the browser. Second, the Back command in many browsers will not recognize the page that began the pull.
Using the example above, putting the line <META HTTP-EQUIV="Refresh" CONTENT="5; URL=file.html"> into index.html will let me view index for 5 seconds. Then the browser loads file.html. When I hit the Back button, I go back to the page I was at BEFORE index.
Thus, if you're going to add client pull, it will save you a bit of trouble, if you add the META refresh tag at the last possible moment.
4. It can be confusing to some visitors
While some might be impressed with your use of client pull, others will just wonder what happened. If your goal is to disorient as many people as possible, client pull is a very effective tool. Otherwise, a page author should at least give the visitor some clue as to what's going on.