Why
$(function () { $(window).bind(\'popstate\', function () {alert(\'pop\');}); window.history.pushState(null, \'\', \'/foo\'); });
You can manually trigger popstate event on window every time you call history.pushState().
popstate
window
history.pushState()
history.pushState(state, '', url); var popStateEvent = new PopStateEvent('popstate', { state: state }); dispatchEvent(popStateEvent);