[thelist] What is the Best Practice for Single Page Redirects?

Aredridel aredridel at nbtsc.org
Thu Jul 10 15:03:14 CDT 2003


On Thu, 2003-07-10 at 13:56, Jeff Howden wrote:
> ari,
> 
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > From: Aredridel
> >
> > > <meta http-equiv="REFRESH"
> > >       content="0;URL=url/goes/here/">
> >
> > The meta-refresh is good when you want the user to know
> > they're being redirected, [...]
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 
> that depends on the timeout you have set.  if it's 0, they won't even see
> the redirect.

Except as the flash of content before the browser figures it out.

That's why I used "5" in my examples.  It still messes with navigation,
however.

> 
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > It should not be used with a timeout of zero, because it
> > makes using the back button on the browser painful.
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 
> that simply isn't true.  if there's a timeout of 0, the page with the
> redirect is replaced in the browser history with the page being redirected
> to.  it behaves identically to sending a 302 object moved header from the
> server.

Not really.  Just in newer browsers. . . it's a common bug.

> 
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > The redirect method is better for most other things: a
> > permanent-redirect code sent to a browser will allow,
> > say, a browser, to automatically update bookmarks, [...]
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 
> if there were any browsers on the market that actually implemented that.

It's being added, and search engines do it already.

> 
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > By the way, the "proper" way to do a refresh is not with
> > a meta tag, but the actual HTTP header:
> >
> >     HTTP/1.1 200 OK
> >     Refresh: 5;URL=/foo/bar
> >     ...
> >
> >     Content goes here
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 
> either way is "proper".

Except that it's metadata more than content, and belongs with the
header, not the body.

> 
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > Whereas a redirect should look like this:
> >
> >    HTTP/1.1 302 Temporarily Moved
> >    Location: url-goes-here
> >    ....
> >
> >    Content goes here
> >
> > and for a permanent move (as in a page having been moved to a new server
> > or location)
> >
> >    HTTP/1.1 301 Permanently Moved
> >    Location: url-goes-here
> >    ...
> >
> >    Content here
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> 
> be warned that many browsers don't correctly interpret a 301 status code.
> even the search engines recommend that you use a 302 if for all redirects.


Yeah -- I browser-sniff and only send when I'm sure.



More information about the thelist mailing list