Hello,
We have one problem with infinite scroll: the correct results are not loaded again, after coming back to the page.
* The users scrolls, let's say to page 3 and clicks the last entry
* now he uses the back function of his browsers
-> only the first page is loaded using infinite scroll:
Solution:
* contain scrolling information within the url
* after coming back: reload all scrolled elements
a little bit improved: also store the clicked element and page it was on, so this could be loaded first and all other pages lazy loaded after that.
I understand the reasons, but this is by design, I will explain here why (and why we should not change it)
Infinite scrolling (I believe since 1.11) uses history.replaceState, since it needs to:
- Adjust the URL to the current pagination page
- Not generate history points, because it is quite difficult to compose/keep/cache the View content on the previous page.
- We could have implemented it to be using the current caching method we have in Toolset Views, but imagine:
A 100+ pages View (or more?), and dealing with the cache of 99+(or more?) infinite scrolling states, which basically containg the same data over and over.
It cannot be done this way, in infinite scroll.
We assumed (kind of what we see elsewhere on infinite scrolls) that when a user is in a page A, enters a page B with infinite scrolling and then goes back in his browser, he expects to get to page A again, not been taken to his previous scroll point (Going back in the browser may in this case take long, and it's all to be cached)
Any other effect but Infinite Scroll uses history.pushState so a new history point is generated.
Clicking back provides the "right" URL, and to apply the right View content we will use the same method we use when actually getting the current (-1) page.
Combined with our caching system, this can be done without any further server call!
Hence, we had to restrict the Infinite Scroll to this behaviour:
If a user in page A that then gest to a page with a View with manual AJAX pagination with an effect of infinite scrolling, and scrolls, clicking the back button will take him to the previous page A.
In any other pagination effect, back means, going back one page (paginated page in this case)
I hope it is clear why we cannot change this, and Please let me know if there are any doubts left
Hello Beda,
Thank you for the clarification. I still hope that you will find an improved solution for infinite scrolling and leaving the page, as this would be really nice.
Thanks,
Adrian