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

warn on close unsaved #104

Open
forresto opened this issue Mar 21, 2013 · 2 comments
Open

warn on close unsaved #104

forresto opened this issue Mar 21, 2013 · 2 comments

Comments

@forresto
Copy link
Member

Chrome has a new two-finger scroll to navigate history, which annoyingly erased some unsaved work.

thoughts:

  1. load app or start new
  2. change it
  3. change hash to unsaved
  4. if closed or navigated from that state, warn

Warnings are kinda lame, and an autosave that reloads your last state might be less annoying, but that doesn't help if you have been working on an image or animation...

@piatra
Copy link

piatra commented Apr 4, 2013

I've been working on a patch for this. It would use window.onbeforeunload which triggers a native alert giving the user the option to stop the back/forward action that might have been accidentally triggered.

The problem I'm having is that the event isn't triggered if all that changes in the location bar is the hash. You have to navigate to another page/domain etc. But in the case of this app changing the hash might send you away from your app and lose progress. I'm not sure if you can get around this limitation.

How about auto-saves ?

@forresto
Copy link
Member Author

forresto commented Apr 5, 2013

Autosaves can be annoying. onbeforeunload is a good direction I think. http://backbonejs.org/#Router router.on("route", function() {}); might help to listen for internal hash changes.

Note: I'm currently hacking up iframework.js to try to make it more modular and easier to maintain.

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