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

Ian Hickson ian at hixie.ch
Wed Mar 10 18:44:36 PST 2010

On Thu, 11 Feb 2010, Ojan Vafai wrote:
> Currently, modal dialogs that fire during beforeunload/unload events are 
> used to confuse users into not being able to leave websites (e.g. to 
> tell the user to click on the wrong button for in the browser's 
> beforeunload alert dialog). They also add a layer of complexity to 
> browser shutdown behavior. I can't think of any legitimate use-case for 
> opening a modal dialog when a user is trying to navigate away from a 
> page.
> Proposal: Opening a modal dialog during beforeunload/unload should 
> either throw an error or just silently fail.

I haven't made a change to the spec here. I do believe, however, that it 
would be perfectly reasonable for a user agent to offer the user the 
choice to stop supporting JavaScript from any modal prompt. Other possible 
ways of handling this are to make the alerts tab-modal only, and to still 
allow navigation using the UI (location bar) while one of these "modal" 
dialogs is up, and simply aborting all running scripts when that is done.

Basically, I think this is a UA UI issue, and out of scope for the spec.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list