4 ms·
Clicking the back button after navigating away from the infinite scroll madness should return to the same spot in the infinite scroll list.
by slig 5y ago
Clicking the back button after navigating away from the infinite scroll madness should return to the same spot in the infinite scroll list.
- Thorrez 5y agoThat's kind of tricky. I assume the list is allgorithmically generated. So simply having the back button go back to the list, and down to item 50, might give you a list that looks completely different. Even HN might have this problem a bit. If you visit the homepage you click an article, spend some time reading it, then click back, the homepage might have changed, and even post you were reading might not even be on the homepage anymore. HN is much less bad than infinite scroll sites, because HN's homepage is the same for everyone, and doesn't change nearly as often. One way to to solve this might be to store a session ID as a query parameter that gets automatically added when you visit the homepage, and store the complete state of each session either serverside or locally in the browser. Then when you navigate back to that session ID, you get the same page. There are a number of downsides to this though. The session ID in the URL is ugly, there's a lot of storage needed for all these session, sessions likely need to be pruned at some point (so the back button will stop working at some point), and it's very difficult to figure out what to do when multiple tabs open the same session ID.