Reputation: 737
In my site, list page loads all data in table rows. It keeps loading when user scrolls to the bottom of page(infinite scroll). This works fine. User can click a link from row and lands on another page on subdomain. When user clicks back button to list page, it fires scroll event and loads data. Sometime scroll event fired few time(say 3 to 5 api calls happens)
Site is built with Vuejs. I have tried few suggestion like window.onpopstate
, vuejs' navigation guards. window.onpopstate
doesn't work. Vuejs' beforeRouteEnter
not helping. Because even before a flag is captured in beforeRouteEnter
, scroll event fires.
Is there any way to stop scroll event being fired by back button click?
Upvotes: 0
Views: 266
Reputation: 955
This is possibly what you are looking for:
if ( 'scrollRestoration' in history ) {
history.scrollRestoration = 'manual';
}
Upvotes: 2