We can use fetch() for all major browsers and for IE we can still use XHR. The problem with sendBeacon() is, it send data whenever browser thread is available to send, it may send data before unload, it may send data during the reload, it may send data after the reload as well, and that solution is not working when we want to send data synchronously before navigation or reload.

SendBeacon() can be used for log, analytics but not something that we need data before the page reloads.

UI | Mobile-First | Accessibility | Angular | NodeJS | Data Visualization | JavaScript | MS Bot Framework | Dialogflow

Love podcasts or audiobooks? Learn on the go with our new app.