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.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Abhinav Kumar

Abhinav Kumar

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

More from Medium

SECRET TO A PHOTOGRAPHIC MEMORY

kyve1g26gdaq79zaefcv7cxmhx5kw50qs8jverf8npj

What’s Luck Got To Do With It

Dads Would Die for Their Kids But Won’t Live For Them