navigator.sendBeacon is a great way to phone home, especially in onunload or onbeforeunload.
Shutting down CEF doesn't wait for the sendBeacon queue to be flushed before exiting. Is there any way to wait for this to happen before quitting?
davetclark wrote:That page talks about receiving responses from AJAX requests in onunload. In this case, we don't care about the response, because navigator.sendBeacon doesn't even give you a response, it's for 204 No-Content type messages.
Because synchronous XMLHttpRequest is deprecated in favor of navigator.sendBeacon, I was expecting to be able to use it for this usecase, but it won't work if the browser doesn't at least try to send the data before shutdown.
It probably is trying to send the data, but depending on how long shutdown takes it may not complete. In other words, you're introducing a race condition during shutdown.
Users browsing this forum: No registered users and 121 guests