onunload Ajax function not working in Chrome

2.6k Views Asked by At

I am developing an app that needs to store updated data in a database when the user leaves the page. To do this I have bound a Ajax function to the "onunload" event of the page. This works in every browser except Chrome. I have also tried "onbeforeunload" but the result is the same.

I suspect it something to do with Chrome being over zealous in it's security. When trying to test the event I found it was blocking the alerts I put in to see if function was even being called and also get the error "Usafe JavaScript attempt to access frame with URL ... Domains, protocols and ports must match." The postback is going to a page within the same domain.

Can anyone shed any light on this or possibly provide me with a work around?

1

There are 1 best solutions below

0
On