I am looking into sending the user back two (or maybe more) pages from where they came. What works so far is
<strong>
<a href="javascript:history.go(-3)">
Click here to go back to the view
</a>
</strong>
However, the [history] page being called does not refresh to show the changes.
So I have the idea of referring the referrer. PHP gives me $_SERVER['REFERER']
to use, which is OK but only up to one level. How do I get the referrer (of referrer...) of $_SERVER['REFERER']
?
Pure JS
. No PHP
.
Modify your existing code like this.
<strong>
<a href="javascript:window.name='autoLoad';history.go(-3)">
Click here to go back to the view
</a>
</code>
Now add this JS to the page, where you are being redirected. say test.html
when you click history.go(-3)
function autoLoad(){
if (window.name=='autoLoad') {
location.reload();
window.name='';
}
}
and in the body tag add this
<body onload="autoLoad()">