0

Good day!

I just want to ask a little help on how to redirect the user to the previous page after 5 seconds?

Thank you!

2
Contributors
3
Replies
40
Views
2 Years
Discussion Span
Last Post by blocker
0

I use onload

<body onLoad="setTimeout('delayer()', 5000)">
...
php
<?
function delayer(){
    header('Location: '.$_SERVER['HTTP_REFERER']);
}
?>
...
or javascript
<script>
function delayer(){
    window.history.go(-1);
}
</script>

Edited by PsychicTide

0

thank you PsychicTide!

I tried your code above but it seems its not working on my side? What I did wrong? below is my implementation..

<?php 
function delayer(){
header('Location: '.$_SERVER['HTTP_REFERER']);
} ?>

<body onLoad="setTimeout('delayer()', 5000)" id="error-page">
0

PsychicTide, Ive implemented the JS and its working!.. Thank you! code below..

<script type="text/javascript">
function delayer(){
window.history.go(-1);
}
</script>

<body onLoad="setTimeout('delayer()', 5000)" id="error-page">

However this one works too with only one line of code..

<meta http-equiv="refresh" content="5;URL='<?php echo $_SERVER['HTTP_REFERER']; ?>'" />

Problem Solved.. Thank you!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.