4 ms·
I see, breaking back button and links is one problem with that is mentioned a lot with SPAs. However, with a good routing library can easily solve both of these
by pritambarhate 10y ago
I see, breaking back button and links is one problem with that is mentioned a lot with SPAs. However, with a good routing library can easily solve both of these, especially when targeting modern browsers, IE11+, Android 4+ and iOS 8+.
Even for older browsers, in "no-framework" setting, I have used https://github.com/mtrpcic/pathjs https://github.com/mtrpcic/pathjs with a lot of success.
Getting scroll position to stay where you left is tricky, though. Has anybody posted some tricks on getting this right?
- williamle8300 10y agoMost routers have a "onBeforeNavigate" hook that you can use to cache the scroll position. In that regard, it's not difficult... but where to cache it is a whole 'nother question!