[Dojo-interest] xdomain and synchronous calls
Erick Feiling
starbuckzero at gmail.com
Wed Feb 28 11:41:17 MST 2007
Popping up another window that makes the call on exit/unload could help. In
the new pop-up display a message and close it once it's done.
On 2/28/07, Sten Duncan <stenduncan at gmail.com> wrote:
>
> 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.
>
>
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20070228/981e8496/attachment.html
More information about the Dojo-interest
mailing list