wait befor redirect

Javascript coding ..

Moderators: macek, egami, gesf

iam4423
New php-forum User
New php-forum User
Posts: 50
Joined: Fri Jan 20, 2012 8:00 am

wait befor redirect

Postby iam4423 » Thu Apr 19, 2012 9:18 am

basically i have a very simple redirect in my site

Code: Select all

<script type='text/javascript'>

window.location = '".$_SERVER['HTTP_REFERER']."'

</script>

its echo'd with php where needed and works fine but i wan to put a delay on it so i can show a message befor redirecting (much like phpbb does when you login and stuff) does anyone know how i can do this?

i have tried

Code: Select all

<body onLoad='setTimeout('delayer()', 5000)'>
but it doesnt work. any help would be appreciated

thanks

User avatar
minimihi
New php-forum User
New php-forum User
Posts: 238
Joined: Sat Apr 14, 2012 11:57 am
Location: Vilnius, Lithuania

Re: wait befor redirect

Postby minimihi » Thu Apr 19, 2012 9:47 am

use

Code: Select all

<?php header('Refresh: 5; url = http://www.php-forum.com'); ?>

if it doesn't work, you always can use HTML meta tags to refresh to different page

Code: Select all

<meta http-equiv="refresh" content="5;url=http://www.php-forum.com" />

iam4423
New php-forum User
New php-forum User
Posts: 50
Joined: Fri Jan 20, 2012 8:00 am

Re: wait befor redirect

Postby iam4423 » Thu Apr 19, 2012 10:01 am

the php works a treat cheers that makes it so much easier


Return to “JavaScript”

Who is online

Users browsing this forum: No registered users and 0 guests