JSFiddle - React, Tailwind, and code Playground

by juberti

HTML

<h1>
onbeforeunload test
</h1>

JavaScript

window.onbeforeunload = () => { window.localStorage.setItem('dying', true); }
window.onunload = () => { window.localStorage.setItem('dead', true); }
setInterval(() => { console.log("Still alive..."); }, 1000);