TypeError: $(...).unload is not a function - JQuery 3.1.0
Try to change like below, because you are using jquery-3
$(window).on("unload", function(e) {
alert("call");
console.log("this will be triggered");
});
The correct answer would be this:
$(window).on("beforeunload", function() {
// your codes
});
Unfortunately, as of Chrome on a PC in Apr 2020, this is not triggered