I want to post data before unload (just before visitor closes page). Unload may vary on different browsers, so I have done this following script;
$(document).ready(function(){
var runme = true;
$(window).bind('beforeunload', function () {
if(runme){
if ($("#benyaziyormuyum").val()=="evet") {
$.post("yazmabirak.php", {
karsidaki: "exited",
});
}
runme=false;
}
});
$(window).unload(function () {
if(runme){
$.post("yazmabirak.php", {
karsidaki: "exited",
});
runme=false;
}
});
It works on all browsers, except Chrome. My question is, which before unload function should be used to make it work on Chrome ?