Return and reload the page - one button

I need to go back to the previous page and refresh it. I use history.go (-1), but the form on the previous page does not reload.

Thanks for answers.

+3
source share
4 answers

If you open the page again, it should automatically refresh. You can probably get the URL of the link page through document.referrer Hope this helps.

+5
source

As of June 10, 2014, I was testing the latest versions of Chrome 35, FireFox 29, and IE 11. Only Firefox did not reboot when I did location.history.back (). So I replaced location.history.back () with

location.href = document.referrer

So my back button now works like this:

<a href="#" onclick="location.href = document.referrer; return false;">Back</a>
+5

 <% Response.AddHeader "Pragma", "no-cache" %>
  <% Response.Expires = -1 %>

asp

this

0

I think I came up with a way to do this. By adding a random parameter to the url, we force the browser to update ...

var backLocation = document.referrer;
if (backLocation) {
    if (backLocation.indexOf("?") > -1) {
        backLocation += "&randomParam=" + new Date().getTime();
    } else {
        backLocation += "?randomParam=" + new Date().getTime();
    }
    window.location.assign(backLocation);
}
0
source

All Articles