Page 1 of 1
Making the page wait a few seconds then redirect
Posted: Sat May 17, 2003 5:39 pm
by scr0p
I have a guestbook, wehn the user posts a comment, it will say "posted" then I want the page to wait 2-3 seconds and redirect back to the page showing the comments, how would I do this? I think these forums do that when I post.
ok these forums go to the 'view entry''s' page but how would I maKe it redirect automatically.
Posted: Sat May 17, 2003 6:35 pm
by llimllib
From
some website I found on google:
<META HTTP-EQUIV=Refresh CONTENT="10; URL=
http://www.htmlhelp.com/">
tells the browser to load
http://www.htmlhelp.com/ 10 seconds after the current document has finished loading. Not all browsers support this, so authors should provide an alternate means of moving to the new page where necessary. The Refresh header is sometimes used for "splash screens" or when a page has moved, but the technique is not very effective since users may not even be looking at the window that is to be refreshed and since it messes up the user's history on many browsers. Some search engines penalize pages that use a Refresh of a few seconds or less.
So, if you want to direct them to page x, just generate the URL dynamically.
Posted: Sat May 17, 2003 7:30 pm
by evilcoder
use meta, or use php
Code: Select all
<?php header( "Refresh: 3; url=the url" ); ?>
Thats how i would do it.
Posted: Sun May 18, 2003 1:04 pm
by llimllib
oh yeah, forgot about the header function...bit rusty on my php. Newbies always have trouble with it though, because they don't realize that you must send a header before *any* HTML gets sent to the client. This is becuause header($string) adds string to the HTTP response header sent by the server to the client, and most newbs don't know an HTTP header from a tomato.
That's why I prefer to tell them to dynamically generate the meta tag.