-
26 Oct 2007 7:31 AM #1
delay closing of a browser window
delay closing of a browser window
Hi,
I have an event listener:
In the function teminateSession I`m sending an ajax request to the server to tell him that the session should be closed. I need to:Code:Ext.EventManager.on(window, 'beforeunload', terminateSession);
- delay the closing of the window until I get a response from the server.
- or for a few seconds so I`ll know the server probably got my ajax request.
Is it possible?
Thanks
-
27 Oct 2007 2:45 AM #2
-
27 Oct 2007 3:37 AM #3
This will probably just be fire and forget, but it should get enough time to send a small "logout" request.
We do this in our legacy app which maintains a stateful session from the webserver back to the legacy backend code which maintains a unix process. We try to clear it up as soon as the use navigates away of closes the window.
-
27 Oct 2007 7:22 AM #4
Sounds like a job for a Synchronous Call..
Sounds like a job for a Synchronous Call..
With this in place, the window would not close/back/forward until you get a response:
Code:var terminateSession = function(){ var response = Ext.lib.Ajax.request('PUT','logout.php', null,null,{async:false}); //if you wanted to prevent the action just: // return false; }"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.
-
27 Oct 2007 7:40 AM #5
It's not an event you can cancel.


Reply With Quote

