I like the improved usability this could offer, but there are some
issues that make me hesitant to get behind this suggestion...
Portability and cross-browser compatibility are really important to the
future of TiddlyWiki. Anything that goes into the TW *core* needs to
work in ALL browser environments, especially if we are going to rely on
catching a browser event as the 'safety net' for preventing TW data
loss on exit...
The use of onbeforeunload has some serious limitations in this regard:
1) It's an MS extension that is not part of the W3C standard.
2) Firefox only reluctantly implemented this, after a 2.5 YEAR
discussion, and there are cross-browser concerns (due to MS
non-standard event handling such as implicit use of event.returnValue),
as well as concerns about abusing this feature to make it hard to leave
a page.
3) According to my web research, onbeforeunload is supported in
IE4+/Win, Mozilla 1.7a+, and Netscape 7.2+, but is NOT SUPPORTED in
Opera, Safari, Konqueror, and many other alternative browsers, so a
suitable 'onunload' fallback is still REQUIRED to ensure TW data
safety.
Don't get me wrong. I like the improved usability that onbeforeunload
handling would achieve, but I'm not convinced that it can be a
rock-solid reliable replacement for the current onunload handling, for
*all* TW users. This particular 'safety net' feature has GOT to work
right for EVERYONE.
thoughts?
-e
Eric Shulman
TiddlyTools / ELS Design Studios
I agree with you Eric, It's really important to be cross browser
compatible into TW *core*.
I put the Udo's code into systemConfig tiddler and I test it in local
TiddlyWiki or on a web TiddlyWiki. It's really nice. It works like it
would be. That's to say when you try to close your window or load a new
page into it, the good question is asked : "continue or not ?".
And if you chose *continue* the second good question then is asked
"Save or not ?".
For my personal point of view, this two popups are great together and I
will adopt this in myConfig tiddler. Very often I click on my browser
toolBar to open a window and I am editing in web TW. And
unintentionally I Upload my TiddlyWiki because I have no other choice
except lose my editing.
No really I can manage without it now.
But Eric you are right, since it is not cross-browser compatible, it
would not be put into the TW core.
-- BidiX
TiddlyWiki.bidix.info
3) According to my web research, onbeforeunload is NOT SUPPORTED in Opera, Safari, Konqueror, and many other alternative browsers, so a suitable 'onunload' fallback is still REQUIRED to ensure TW data safety.
Actually, I kind of like BidiX's solution to add it as a plugin, and
leave the onunload handling in the core exactly as is. The resulting
interaction sequences are:
Exit? [cancel] ... back to TW
Exit? [ok] Save? [ok] ... changes preserved
Exit? [ok] Save? [cancel] ... changes discarded.
Sure, having two messages show up may not be ideal, but it does seem to
"flow" reasonably.
I like to use the keyboard to respond to these messages. When I am
working on a plugin, I often will click 'permaview' for that tiddler,
do some editing, and then press refresh(F5)-enter to perform a quick
save-and-reload, with the plugin tiddler displayed and ready for more
editing. Even with the second message box, this sequence is simply
F5-enter-enter, so it is still a really easy no-brainer.
I've added this to TiddlyTools:
http://www.TiddlyTools.com/#ConfirmExitPlugin
give it a try and see how it feels...
-e
config.messages.confirmExit = "There are unsaved changes in TiddlyWiki."
window.onbeforeunload = function(e){if(store&&store.isDirty&&store.isDirty())return config.messages.confirmExit;};
I propose to implement Udo's suggestion, and to attempt to mitigate
confusion by making the 'new' alert look as different as possible from
the existing onunload one, and suppressing the existing onunload alert
when onbeforeunload is available.
Cheers
Jeremy.
--
Jeremy Ruston
mailto:jer...@osmosoft.com
http://www.tiddlywiki.com
Necessarily, the new 'confirm exit' alert uses the following button meanings:
cancel = safe option; don't exit from the page
ok = unsafe option; exit away from the page
While the existing 'last ditch save' alert uses the following button meanings:
cancel = unsafe option; discard any outstanding changes
ok = unsafe option; save any outstanding changes
Now, there's clearly a reasonable argument for trying to avoid the
inconsistency by switching the meaning of the buttons in the existing
'last ditch save' alert (we can't change the meaning of the buttons in
the 'confirm exit' alert).
All the same, on balance, for historical consistency I propose to
leave the existing alert as it is.
Cheers
Jeremy.
On 10/02/06, christianhauck <christian...@googlemail.com> wrote:
>
> Jeremy,
> that's what I meant, you just express it much more clearly ;-)
>
>
>