I would like to have the History.back();
functionality with a complete refresh of previous page.
Any idea how to do that (and make it work in IE, FF and Chrome).
The History function is another method for refreshing a page. The history function is used as usual to navigate back or forward by passing in either a positive or negative value.
The History. back() method causes the browser to move back one page in the session history. It has the same effect as calling history.go(-1) . If there is no previous page, this method call does nothing.
HTML | DOM History back() Method The History back() method in HTML is used to load the previous URL in the history list. It has the same practical application as the back button in our web browsers. This method will not work if the previous page does not exist. This method does not contain any parameter.
The history. back() method loads the previous URL (page) in the history list. The history. back() method only works if a previous page exists.
You could redirect (by window.location) to document.referrer
i.e.
window.location.href = document.referrer;
Internet Explorer fix for passing referrer to a particular location:
if(IE){ //IE, bool var, has to be defined
var newlocation = document.createElement('a');
newlocation.href = URLtoCall;
document.body.appendChild(newlocation);
newlocation.click();
}
You can also use the location replace() method:
window.location.replace(document.referrer)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With