JSFiddle - React, Tailwind, and code Playground

HTML

<a href="http://www.google.com">google</a>

JavaScript

$(document).click("a", function(event){  
   $(window).trigger("unload");
});

window.onbeforeunload = function () { return "Your changes to the survey have not been saved?" };