Hi I have been searching alot for a solution to be able to be able to send an ajax request when the user closes the browser.So far all I have found is the onBeforeUnload event.This is what I have so far:
$(window).bind('beforeunload', function () {
$.ajax({
type: 'GET',
async: false,
url: '/Home/Get/'
});
});
and I have also tryed using the native javascript:
window.onbeforeunload = function (e) {
$.ajax({
type: 'GET',
async: false,
url: '/Home/Get/'
});
};
Now my interesest is not to recieve back the callback I only want to be able to execute a method on the server side when the browser closes.
This seems to work reliable on chrome , firefox an IE10 , but it does not work on IE9 and IE8 at all.
Does anyone know a solution for this problem?