I am using the following code which runs fine in Internet Explorer but is not working in Firefox.
When the user closes the browser, a webmethod has to be called, which updates the bit field IsLogin=false
in the database.
window.onbeforeunload = function (e) {
var evt = window.event || e;
var y = evt.clientY || evt.pageY;
if (y < 0 || evt.clientX<0) {
$.ajax({
type: "POST",
url: "/Application/WebForm1.aspx/Update",
async: false,
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert('Sucessfull Call');
}
});
}
}