window closing event js
snippet in javascript

window closing event js

user3889

window.onbeforeunload = function(){
  alert("You are now leaving, are you sure?")
}