W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2008

[whatwg] salvaging work while navigating away from a web app -- onunload="confirm('save before quitting?')

From: Philipp Serafin <phil127@gmail.com>
Date: Mon, 17 Nov 2008 14:47:29 +0100
Message-ID: <492175F1.4010902@gmail.com>
Thomas Broyer schrieb:
> On Mon, Nov 17, 2008 at 3:03 AM, ddailey <ddailey at zoominternet.net> wrote:
>   
>> 4. Concerning the first thing I need to fix, I am not sure if HTML5
>> currently provides a solution for. Here's the sitch: because of an extensive
>> use of CTRL sequences in the interface, the user will sometimes accidentally
>> do something like CTRL R (which the browser thinks is a refresh command). In
>> a regular app, if users stand in jeopardy of losing all their work, the app
>> usually warns them before quitting. The way I found to work around it (that
>> used to work) was to use onunload="confirm('save before quitting?').
>> Currently, however, IE seems to have removed my ability to intervene before
>> it erases all work. onbeforeunload=function (){ fix(everything)} doesn't
>> seem to help either.
>>     
>
> I'm not sure you can automatically save but what you can do is cancel
> the unload with a prompt.
>   
What you can do for an "emergency save" is to fire a *synchronous* XHR 
during the unload event. This will freeze the UI but since the user was 
about to close the page anyway, this shouldn't matter much.
Received on Monday, 17 November 2008 05:47:29 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:07 UTC