I am using history.pushState to change the url without loading the page. When browser's back/forward button is clicked, a 'popstate' event is fired which I capture using
window.addEventListener('popstate', function (e) { // something });
The code above does proper Url changes, however,after execution of eventListener function, the code snippet below reverts the Url to default Url i.e. removes all the url changes.
if ( !eventHandle ) {
elemData.handle = eventHandle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
I am using history.pushState to change the url without loading the page. When browser's back/forward button is clicked, a 'popstate' event is fired which I capture using
The code above does proper Url changes, however,after execution of eventListener function, the code snippet below reverts the Url to default Url i.e. removes all the url changes.
How can the issue be addressed? Thank you.