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

Avoid "unload" to preserve page back/forward cache #168

Closed
jakearchibald opened this issue Dec 16, 2013 · 3 comments
Closed

Avoid "unload" to preserve page back/forward cache #168

jakearchibald opened this issue Dec 16, 2013 · 3 comments

Comments

@jakearchibald
Copy link
Contributor

Add an unload listener

window.addEventListener('unload', function(){
breaks the back/forward page cache.

The Chrome bug was closed almost a year ago now, it's probably save to remove right?

Failing that, switch to postMessage? https://github.com/NobleJS/setImmediate/blob/6dd6a2dd3162f15848ca4d609d70b778b9b59261/setImmediate.js#L124

(issue spotted by @tobie‎)

@stefanpenner
Copy link
Collaborator

@jakearchibald removing the fix is a good idea, do you have time for a PR?

the back/forward page cache issue seems like a bug unto itself?

PostMessage has many other issues: cujojs/when#197 (comment)

@jakearchibald
Copy link
Contributor Author

The reason the back/forward page cache goes away with "unload" is:

  1. User clicks link
  2. Unload event fired
  3. Unload listener does some teardown work
  4. User clicks "back"
  5. Previous page reshown very quickly in previous state, but it's broken because of the teardown stuff

@stefanpenner
Copy link
Collaborator

@jakearchibald ah.

Also, thanks again for the bug report and the subsequent PR.

calvinmetcalf added a commit to calvinmetcalf/immediate that referenced this issue Apr 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants