JSFiddle - React, Tailwind, and code Playground

HTML

<a href="http://espn.com">ESPN</a>

JavaScript

window.addEventListener("beforeunload", function (evt) {
      evt.returnValue = "Setting this to anything but an empty string, causes this to work!";
    }, false);