Copy the code code as follows:
<!DOCTYPE html>
<html>
<head>
<script>
function closeIt()
{
return "Any string value here forces a dialog box to /n" +
"appear before closing the window.";
}
window.onbeforeunload = closeIt;
</script>
</head>
<body>
<a href="//www.VeVB.COm">Click here to navigate to
www.VeVB.COm</a>
</body>
</html>
Compatible with FF, IE, and Chrome's js for leaving or refreshing the page detection, the key part is to have a return