[Dojo-interest] xdomain and synchronous calls
Sten Duncan
stenduncan at gmail.com
Wed Feb 28 11:29:12 MST 2007
I am struggling with a problem involving cross-domain processing and the
page unload action.
Briefly, when the user closes a page (onunload or onbeforeunload) I need to
make an xdomain call to the server - to unregister the user. I don't know
until the page is unloading that the call needs to be made so I can't do it
in advance. The problem is that with an asynch call, once the thread is
released after the io.bind call, the browser exits almost immediately and
the server call never gets made.
In a non-xdomain environment, this works fine since I can make the
io.bindcall synchronous. But in the xdomain environment, the
io.bind is by definition asynch (I'm using the iframe proxy:
XhrIframeProxy).
I've also tried ways to pause the main thread to give the io.bind time to
execute and return, but as we all know there is no "sleep" in Javascript.
And if I use something like a timer (setTimeout) I have the same problem
with the thread being released and the page exiting before the server call
is made/completed. Putting the main thread into a loop doesn't help either -
I get the popup telling me that a script appears to have stopped running,
etc. and this is completely unacceptable for a user app.
Does anyone have any ideas about how to either:
1. do a synchronous xdomain server call?
2. pause the main thread so that an asynch xdomain call has time to return?
Any help would be enormously appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20070228/a1e4e20a/attachment.html
More information about the Dojo-interest
mailing list