//for infinite scroll usage, need to use pushstate $(window).on('resize scroll', function() { if ($('#nexpost').isInViewport()) { window.history.pushState("", "", '/newpage'); } else { // do something else } });