[whatwg] prompts, alerts and showModalDialog during beforeunload/unload events

Maciej Stachowiak mjs at apple.com
Thu Feb 11 19:53:34 PST 2010

On Feb 11, 2010, at 7:42 PM, Jonas Sicking wrote:

> 2010/2/11 Scott González <scott.gonzalez at gmail.com>:
>> On Thu, Feb 11, 2010 at 9:55 PM, Tab Atkins Jr.  
>> <jackalmage at gmail.com>
>> wrote:
>>> I commonly see them put to *good* use by editting applications,
>>> warning you if you attempt to leave the page without saving.  It has
>>> saved me from accidentally lost effort just in the past few days in
>>> both my email and one of my wikis.
>> I use dialogs in this fashion as well. Users get very frustrated  
>> when they
>> accidentally leave a page with unsaved content and this is the  
>> easiest
>> improvement for most developers to make.
> However you can accomplish this using the onbeforeunload return value.
> No need to open modal dialogs using showModalDialog/input()/alert()
> etc.

The built-in beforeunload dialog lets you cancel leaving the page, but  
what if the page wants to offer the common three "Quit without  
Saving", "Save and Quit", "Cancel Quitting" options that native apps  
often do, when you close a window with unsaved work?

(Mind you, I'm not sure that is great UI, and it might be preferable  
to just always save on quitting, but I can imagine interaction  
designers wanting the familiar interaction above.)

> Though I'm not sure what exactly Ojan is proposing we forbid?

I think his suggestion is to forbid all of window.prompt,  
window.alert, and window.showModalDialog. Persumably window.confirm as  

I'd like to see some examples of modal dialogs (of whatever variety)  
being used abusively before rendering judgment.


More information about the whatwg mailing list