For a reason or another, my final answer never made it here... So here
it is:

  - Louis

---------------------

FOUND IT !

Here : 
http://stackoverflow.com/questions/6745323/alternative-of-onbeforeunload-any-idea/6745584#6745584

"OnBeforeUnload is supported in Safari - what is not supported is the
use of AJAX ... you need to use a Synchronous call - you can use alert
to verify this....."

So I changed my code for something like this :

window.onbeforeunload = function(){
        $.ajax({
                type: "POST",
                url: [...],
                async:   false,
                data: [...],
        });
}

The Ajax query (Still using Jquery) calls a php file who then call a
custom command on the server (based on inlinepush) and the server take
care of the rest. Unless an APE command could be call by the AJAX
request itself...?

Anyway, it's not the prettiest solution, but it's works in Chrome,
Firefox AND Safari (Didn't tried IE yet, on a Mac :P) and it seems to
works whatever way you're leaving the page. The other way to make this
work browsers would be to make sure all RAW or CMD are send to APE
using a synchronous call (or provide the option to have a particular
command/raw be sent this way), am I right?

Anyway, I say close enough for now lol. If someone is interested to
see all the code I used to add in his own app, just asked me. Or if
you have a prettier solution... ^_^.

Thanks everyone,

  - Louis


P.S.: I hope Carles is still reading this. I kind of stole his
question lol.

-- 
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

Reply via email to