meemooapp icon indicating copy to clipboard operation
meemooapp copied to clipboard

warn on close unsaved

Open forresto opened this issue 11 years ago • 2 comments

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...

forresto avatar Mar 21 '13 09:03 forresto

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 ?

piatra avatar Apr 04 '13 23:04 piatra

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.

forresto avatar Apr 05 '13 11:04 forresto