Opened 13 years ago

Closed 12 years ago

#786 closed defect (wontfix)

dojo.event.connect not showing onbeforeunload prompt

Reported by: jonathan.aquino@… Owned by: alex
Priority: high Milestone: 0.9
Component: Events Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

The following non-dojo.event.connect code shows a "got here" alert followed by a "this is a test prompt" dialog.

dj_global.onbeforeunload = function() { alert('got here'); return 'this is a test prompt'; }

However, when we use dojo.event.connect, we just get the "got here" alert.

dojo.event.connect(dj_global, 'onbeforeunload', dojo.lang.hitch(this, function(event) { alert('got here'); return 'this is a test prompt'; }));

I would have expected the behavior to be the same in both cases.

Also it would be useful if dojo.event.connect worked with onunload; then we could prevent one onbeforeunload handler from overwriting another.

Change History (2)

comment:1 Changed 13 years ago by dylan

Component: CoreEvents
Milestone: 0.5
Owner: changed from anonymous to alex

comment:2 Changed 12 years ago by bill

Resolution: wontfix
Status: newclosed

Yeah, you should use dojo.addOnUnload(). I think the problem with the above connect is that it tries to happen after page unload, which is of course too late.

Note: See TracTickets for help on using tickets.