Return to the page?

Is there a way for the page to return the page to load using javascript or php?

+2


source to share


4 answers


PHP is server side, so no. The page will be delivered to the client and when it reaches the client, the browser will need to go back.

You have two options. Javascript or HTML meta tags.

An example javascript mootools would be something like this:

window.addEvent('domready', function() {
   history.go(-1);
});

      



You can also post it in HTML meta tags

<meta http-equiv="refresh" content="2;url=http://example.net">

      

Hope this helps! Be aware that this behavior tends to be confusing to the user and should be used with caution.

+4


source


Yes, use history.go(-1)

in Javascript.



For bonus points, make sure there is actually a page to return to before invoking it, such as this question suggests .

+4


source


$(function() { history.go(-1); });

      

+1


source


ok another solution:

<body onload='history.go(-1);'>
      

Run codeHide result


0


source







All Articles