JSFiddle - React, Tailwind, and code Playground

by megaadriano

JavaScript

window.onbeforeunload = function (e) {
// Your logic to prepare for 'Stay on this Page' goes here 
		alert('teste')
    return "Please click 'Stay on this Page' and we will give you candy";
};