What is and what is not possible to do inside the beforeunload callback ?
beforeunload
Is it possible to open an XHR/fetch and send data to the server ? If no, is i
To help some of the people in the comments on the first answer, check out this functionality to make an XHR request during the unload event: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon