I am trying to display a share box . my requirement is to display a bootstrap model box , if and only if user click on the close tab/browser button . if its possible how ?
HERE IS MY CODE which is not working :
var unhook=0;
jQuery(window).bind('beforeunload', function(e) {
if(!unhook){
var message = "Why are you leaving?";
$("#myModal4").modal();
console.log(e);
// e.returnValue = message;
// return message;
}
});
$(function () {
$("a").click(function {
var unhook=0;
});
});
NOTE: I don't want to show simple alertbox , I have to display a modelbox where user will put the review . that's why my question is different