Go back and reload page - one button

Delicja picture Delicja · May 10, 2012 · Viewed 23.6k times · Source

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

Thanks for answers.

Answer

Yngvar Kristiansen picture Yngvar Kristiansen · Jun 10, 2014

As per 10th June 2014, I have tested latest Chrome 35, FireFox 29 and IE 11. Only Firefox didn't do a reload 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>