Dan's Web Tips:Auto-Refreshing Pages[<== Previous] | [Up] | [Next ==>] See also Danish, Hindi (from The Unbiased Reviews) and Portuguese translations (done by others in their own site, with my permission) TIP: Here's how to make your page automatically load another page after a given number of seconds. Now, do you really, really need to do this? This message will self-destruct in 30 seconds! Only kidding, but if I was using a "META refresh" tag on this page, it actually would. In spy movies, that's a pretty neat thing, but when you're trying to read a web page it could get annoying... that's why I don't really do it here! You've probably seen web pages that automatically move the user on to another web page, sometimes repeatedly in slide-show fashion. Here's how to do it, but I'll also explain why it's probably a bad idea in most sites. How To "META-Refresh"Use this syntax, within the <HEAD> section of the document:
The contents of the "CONTENT" attribute consist of the number of seconds until the page load takes place, followed by a semicolon and a space, then "URL=" followed by the URL of the site to load. Note that the "URL=" part is within the "CONTENT=" parameter, not a separate parameter.
Since this is an
I should note, however, that the Why Not To "META-Refresh"OK, now you know how to do it. Now here's why you probably shouldn't:
Why To META-RefreshOK, enough negativity; people say I'm too negative, and all I do is keep shooting down ideas rather than propose anything constructive. Killing a bad idea can be a productive thing if it saves everybody from the problems the bad stuff causes, but I will get a bit more positive here by listing a few places where the use of these "refresh" pages might be a useful thing:
And there are probably a few other possibilities. No feature of HTML, or anything else, is totally evil; there are always some good uses. But some "features" are misused more often than they are properly used, so you should think carefully before using them. Even if you do have what seems like a good reason to use an automatic refresh, you may still have to get rid of it... I was in that situation a long time ago. I had used a refreshed page to get around a technical difficulty in a site I worked on for my employer, but when they made a new marketing deal with a major company which involved them linking to that page, somebody at that company objected to the refresh on the grounds that it made it difficult for anyone to return to the original site via the BACK button. (I did use a 2-second pause on the refresh to allow time to go back, as opposed to some other refreshed sites that have no pause and pre-empt the BACK button altogether, but that wasn't enough, since most users don't figure out what's happening quick enough to hit BACK again within this short time.) So I was forced to come up with an alternative, non-refreshed solution really quickly. Let this be a lesson; if you're doing a site that's anything other than your personal home page, you may have a client, boss, affiliate, or other person who will someday demand that you get rid of that annoying refresh right now. It's a lot easier for you to develop the site without a refresh from the start than it is for you to figure out how to do away with it once it's embedded in your site's basic structure! If you do use a refresh in your pages, at least provide a regular link to the next page in addition to the automated refresh, for the benefit of those with non-refresh-supporting browsers and those who don't want to wait for the automatic refresh to kick in. And Now For Something Even More Annoying...Worse than "META refreshes" are web pages that use embedded JavaScript code to load another page. I've encountered sites whose front pages consist entirely of JavaScript code that checks such things as the user's browser type, the time of day, the phase of the moon, or whatever, and then proceeds to launch different pages in each case. Probably the site author thought they were being pretty clever, but what this means is that any user with a non-JavaScript-capable browser, or who has disabled JavaScript (which many users do for security reasons, given the browser security scares that erupt every few months when another bug is found), ends up seeing a totally blank page. This is a really frustrating thing to inflict on your users. And don't forget that the search engine robots see the same thing when they're indexing your site! One U.S. Senator had this sort of front page, and when a constituent complained by e-mail about his inability to enter the site using the MacWeb browser, he got a rude reply from a staffer that "90% of the users use Netscape or Internet Explorer, so that's all we care about." It made me wish I lived in that state so I could vote against this Senator. Rudely turning away 10% of the voters hardly seems like good campaign advice, not to mention the likely higher percentage of people with JavaScript disabled who will also be barred from the site. And don't forget that JavaScript is loaded with incompatibilities between the various implementations; do you really want to trust the whole navigation of your site to a script language that might blow up in a different browser version? Did you test it on all versions of all browsers? I use a JavaScript-capable browser with JavaScript enabled, but I still found sites like those to be highly annoying; since they proceeded to load pages with no time delay (unlike the META-refresh), they made the use of the Back button nearly impossible. Links
[<== Previous] | [Up] | [Next ==>]
This page was first created 16 Nov 1997, and was last modified 24 Mar 2012.
|