Say bye with JavaScript Beacon

Sometimes we want to send a piece of data to our servers when user leaves our website or webapp. Maybe it&rsquo;s for for analytics or even auto-logout when they leave the website. But do you know what is a reliable way of doing it? &#xA; Most of you might say use XMLHTTPRequest (or fetch) in beforeunload or unload events. Like, &#xA; window . addEventListener ( 'beforeunload' , () => {&#xA; fetch…