miguel-perez / smoothState.js

Unobtrusive page transitions with jQuery.
MIT License
4.43k stars 508 forks source link

Detect if back button in 'onAfter'? Returning user to previous scroll location. #345

Open louiswalch opened 7 years ago

louiswalch commented 7 years ago

I am trying to implement custom logic to return the visitor to their previous scroll location when hitting the back button. There are many posts out there about storing it in localStorage/sessionStorage, but the issue is that it would always return to that location even if you returned to the page through a different path then hitting the back button.

Is it possible in SmoothState's onAfter callback to detect how the user got to the page and if they used the back button?

boldcolin commented 6 years ago

I have the same question. I want to disable any page transition when someone hits the back button.