JSFiddle - React, Tailwind, and code Playground

HTML

<a href="http://www.microsoft.com">Click here to navigate to 
      www.microsoft.com</a>

JavaScript

function closeIt()
  {
    return "Any string value here forces a dialog box to \n" + 
         "appear before closing the window.";
  }
  window.onbeforeunload = closeIt;