I've been trying to send a beacon on beforeunload
and it seems to work on pretty much all modern browsers, except Chrome in incognito mode.
This is the code that works in all modern browsers, except Chrome in incognito mode:
window.onbeforeunload = function() {
navigator.sendBeacon("url");
}
Not even this code doesn't seem to work:
window.onbeforeunload = function() {
console.log('before unload')
}
Am I doing anything wrong or is it just Chrome's fault?