I already have a 'Close' button that calls some javascript function. However, if the user just clicks the 'X' to close, the function is never called.
Any way to call a function when 'X' is clicked, or hide the 'X'?
Thanks.
I already have a 'Close' button that calls some javascript function. However, if the user just clicks the 'X' to close, the function is never called.
Any way to call a function when 'X' is clicked, or hide the 'X'?
Thanks.
Use the "onbeforeunload
" javascript event to catch when the user attempts to close the browser or navigate away.
<html>
<head>
<title>< /title>
</head>
<body onbeforeunload="alert('Closing');">
</body>
</html>