3 ms·
> it clears scrolling state by browser back Twitter handles this masterfully (or used to) > or page refresh. Technically you can use history.replaceState to
by bunga-bunga 3y ago
> it clears scrolling state by browser back
Twitter handles this masterfully (or used to)
> or page refresh.
Technically you can use history.replaceState to store, ahem, state on the "current page", so nothing stops you from saving a cursor there to use when loading the content.
The issue with infinite scroll is that very few people know how or care to "make it work correctly"
- SilasX 3y agoI wish browsers did this as a default option. The back button should never have a noticeable delay.
- bunga-bunga 3y agoThey do if you use non-ajax navigation: the scroll position is preserved and so is the document as last seen: https://web.dev/bfcache/ https://web.dev/bfcache/ But once you call history.pushState, the browser is relinquishing control to you. At that point, going “back” only changes the URL, as far as the browser is concerned, and that part is instantaneous.