Is there any way I can get the new page's url when the window.popstate is fired?
window.popstate
window.onpopstate(function (){ newPageUrl = //get the new page's URL })
Use this
window.onpopstate = function (){ newPageUrl = location.href; }