-
26 Mar 2009 5:44 AM #1Sencha - Community Support Team
- Join Date
- Nov 2007
- Location
- Helsingborg, Sweden
- Posts
- 2,455
- Vote Rating
- 49
window.onbeforeunload
window.onbeforeunload
I'm having some trouble grasping how onbeforeunload works (I'm using FF3). I want to prompt the user if unsaved changes exist when they try to leave my page. My handlers are called correctly in both scenarios below, I've tested with an alert which is shown as expected.
This version works, I get a confirm popup, but using this will wipe out any previously registered handlers. Maybe Ext will do some cleaning on beforeunload (right now it looks like Ext cleans up on unload event) and I don't want to overwrite previously registered handlers.
This version does not work, nothing happens when I leave the pageCode:window.onbeforeunload = this.onBeforeUnload.createDelegate(this);
The event handlerCode:Ext.EventManager.on(window, 'beforeunload', this.onBeforeUnload, this);
Does anyone know why this doesn't work?Code:onBeforeUnload : function(evt) { return "message"; }Last edited by mankz; 26 Mar 2009 at 6:42 AM. Reason: changed onbeforeunload typo
-
26 Mar 2009 6:39 AM #2
Code:Ext.EventManager.on(window, 'onbeforeunload', this.onBeforeUnload, this);"be dom-ready..."
Doug Hendricks
Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.
Got Sencha licensing questions? Find out more here.
-
26 Mar 2009 6:42 AM #3Sencha - Community Support Team
- Join Date
- Nov 2007
- Location
- Helsingborg, Sweden
- Posts
- 2,455
- Vote Rating
- 49
That was just a typo in the forum post sorry, I use the code you wrote. Still doesn't work.
-
11 Sep 2012 1:41 AM #4
-
19 Mar 2013 10:47 PM #5
Hi,
I have the issue like i want to show my own message and button names but it is displaying the default message which i dont want. Can anybody help me what i need to do?
Thanks
Url


Reply With Quote

