score:1

<head>
  <meta http-equiv="content-type" content="text/html" />
  <script type="text/javascript"> 
      window.addEventListener("beforeunload", (ev) => {
        ev.preventDefault();
        return (ev.returnValue = "Are you sure you want to close?");
      });
    </script>
    ...rest of the code
</head>

Related Query

More Query from same tag