Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix browser back button! #496

Closed
wants to merge 1 commit into from

Conversation

clockworkgeek
Copy link

Here is an experimental use of sessionStorage. Asynchronous content is cached temporarily (i.e. only until the browser tab or window is closed) and restored whenever infinite scroll is initialised, which is normally on page load. When using the back or forward buttons a browser typically attempts to restore the scroll position after page load, which means the content should have been restored by then. This fixes the biggest complaint of infinite scrolling.

This feature is graceful, it checks for the existence of sessionStorage rather than failing. For better compatibility you can use this sessionStorage shim.

Cache AJAX responses in sessionStorage where available and restore on
page load.
@jacopotarantino
Copy link
Contributor

Nice work! Will merge it in ASAP.

@paulirish
Copy link
Contributor

BTW there is new Google guidance on backbutton friendly inf scroll:

http://googlewebmastercentral.blogspot.com/2014/02/infinite-scroll-search-friendly.html
http://scrollsample.appspot.com/items

@stephanvane
Copy link

Hi,

Is there any update on this pull request? I believe this should be a (very) high priority fix for this awesome plugin. This shouldn't be affected by the google guidelines since this fix leaves the html / server side code intact. The websites should still respond to ?page=2 requests regardless.

@jacopotarantino
Copy link
Contributor

@clockworkgeek could you rebase this PR so it's mergeable?

@clockworkgeek
Copy link
Author

It has been so long I forgot about this! I shall try to bring things up to date soon.

@clockworkgeek
Copy link
Author

My fork was itself forked by articulate and brought up to date. Would it be suitable to merge that instead?

@jacopotarantino
Copy link
Contributor

@clockworkgeek that sounds good to me. thanks again for the help!

@Twansparant
Copy link

Any updates? There are a few workarounds out there like Scroll Frame: https://github.com/artsy/scroll-frame but I would really like to maintain my infiniteScroll setup.
Thanks!

@jackyon
Copy link

jackyon commented Jan 15, 2015

@Twansparant I'm also looking for the solution, I have tried scroll frame, but it is not working perfect on android device.

macbeth pushed a commit to macbeth/infinite-scroll that referenced this pull request Feb 7, 2015
Conflicts:
	jquery.infinitescroll.js
	jquery.infinitescroll.min.js

merged with the current version of the master the fork here :

metafizzy#496

and here
@clockworkgeek
Copy link
Author

Closing this one because #622 has superseded it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants