HTML help needed

I’m moving my web pages and I want to do one of those “you will be forwarded to the new page in just a few moments” things. I can’t for the life of me figure out how it’s done. I’ve tried reverse-engineering some other pages with that feature and am stumped.

Any suggestions?

Fenris

I guess you didn’t try very hard because it took me seconds to reverse engineer this one:

<HTML><HEAD>
<META HTTP-EQUIV=“REFRESH” CONTENT=“1; URL=http:etc.htm”>

Try this:

<HEAD>
<TITLE>Blah blah</TITLE>
<script language=“JavaScript”>
setTimeout(“location=‘http://www.mynewpage.com’”, 20000)
</script>
</HEAD>

You can replace the “20000” with a higher or lower number to increase or decrease the time it takes to forward the reader to a new page.

Yee gads, an easy one. As first on the scene:

You do it with the META tag, usually placed in the HEAD:

<META HTTP-EQUIV=“Refresh” CONTENT=“2; URL=http://go.here”>

The trick is that the CONTENT attribute is heavily overloaded based on the desired operation. For “Refresh” it consists of the seconds delay and “URL=<whatever>” delimited by a semicolon.

I like this reference for most HTML questions:

http://www.idocs.com/tags/

And of course, there’s already two answers while I’ve been writing this, but I’ll answer anyway.

Not all browsers support refresh. Be sure to also have a link on the page to the new page with a message ‘click here if your browser doesn’t forward you’…

In case you’re interested, the “HTTP-EQUIV” tags were added to browsers to allow a web page to contain what normally goes in the HTTP headers. When you get a web page, there is a protocol of communication that goes on between your browser and the web server. Your browser tells the server what file it wants, along with some other stuff like what kind of files it can accept, what kind of browser it is, wheter it has any cookies to send that site, etc. The server responds by sending the file, but it’s preceded by HTTP headers that tell the browser certain things, like what kind of file it is, and maybe even another site to be redirected to.

So the HTTP-EQUIV tags are ways to get the equivalent of HTTP headers, but in the web document, for all the folks who don’t have access to setting the headers themselves.

Hey thanks, I always wanted to know how to do that redirect trick, but I was too lazy to look it up.

BTW, if you’re using Microsoft IIS as you web server, you can set the redirect there and it will be barely noticeable.

Of course, you need to be an administrator to do this.

RealityChuck, excuse me for nitpicking, but it’s not only IIS that has this feature. Any modern web server allows you to redirect pages on the server side.

And while I’m at it… Podkayne, it’s not advisable to use Javascript for such things. Any browser that supports Javascript also supports the Refresh meta tag, and many people disable Javascript to avoid unexpected pop-ups etc. And always follow handy’s advice and put a link in the HTML body, just in case.

As long as this thread is not going away:

When you do this, in addition to actually putting some content with an “in case your browser doesn’t redirect” link on the page, please also actually use a positive number of seconds delay. Specifying a delay of 0 is a way to generate one of those annoying situations where the user cannot back button over your page because they just back onto the redirect page which redoes the redirection before they can click again.

CurtC is correct about the reasoning behind the META tag, and why it has the HTTP-EQUIV attribute but I wouldn’t bet the ranch on the equivalence, since it is being interpreted at a different point in the processing of the page. Logically, it’s simply too late to specify some things by the time the browser has started interpreting document content[sup]1[/sup]. Another popular use would be “Set-Cookie” headers - some references claim that IE does not honor cookies set in the META tag, but a brief experiment suggests that at least version 5 of IE will indeed honor cookies set through META tags - I just tried it, and it seemed to work on both Netscape and IE.

[sup]1[/sup] - you could prescan the content for META tags, or set status indicating you’ve handled them and restart on encountering one that invalidates your current document scanning assumptions. I doubt that anyone does. Too many anomolous situations - what does it mean if I redefine the “Content-type” header?