Jump to content

auto go back to previous page without refreshing or pressing any button


sungpeng

Recommended Posts

Can you explain more what you are doing?

Am sure is a better way to do whatever is trying to accomplish.

 

You can add a meta refresh to the visited script with a delay and use the referrer as the location.

I added a check for the scripts url so does not keep refreshing in a loop.

5 second delay, not sure what doing upon visit

 <?php
$httpreferrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
$this_url     = filter_var("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING);
if (!empty($_SERVER['QUERY_STRING'])) {
    $this_url .= "?" . filter_var($_SERVER['QUERY_STRING'], FILTER_SANITIZE_STRING);
}
if ($httpreferrer && $httpreferrer != $this_url) {
    echo "<META http-equiv='refresh' content='5;URL=$httpreferrer'> ";
}
?> 

If it's some remote site you need to make a script with this code and iframe that website. Many sites block iframes now or have jump out of frame scripts.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.