change location from backbutton browser code example
Example: js edit browser back location
window.onpopstate = function() {
alert("clicked back button");
}; history.pushState({}, '');
window.onpopstate = function() {
alert("clicked back button");
}; history.pushState({}, '');