[webkit-dev] The case for disallowing alerts in unload, redux

Adam Barth abarth at webkit.org
Sun Jun 26 13:49:39 PDT 2011


On Sun, Jun 26, 2011 at 1:40 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
> On Sun, Jun 26, 2011 at 1:37 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
>>
>> On Sun, Jun 26, 2011 at 1:34 PM, Sreeram Ramachandran
>> <sreeram at chromium.org> wrote:
>>>
>>> A confirm() can't actually do the first option ("Don't leave"). I
>>> believe there's nothing a page can do to prevent the navigation once
>>> it is in unload. The only way it can prevent it is by installing a
>>> beforeunload and returning a string.
>>
>> Right.  So a web page can first ask whether a user wants to save states or
>> not.  Then ask whether a user really wants to leave a page or not using
>> beforeunload.
>
> To further clarify, it doesn't even have to use beforeunload.  The important
> thing is that if we disallow confirm in beforeunload, unload, etc... then
> web apps will have no way of asking a user if he/she wants to save states.

Why can't the app just return a string from the beforeunload handler?
That's the usual way of handling this situation.

Adam


More information about the webkit-dev mailing list