Hi
i have a .js file to control when a user close the browser tab then destroy all session on the server.
This control when not fire when change the page with a link 'a' or submit a form else the control will fire.
I have a listbox ajaxed and when i click an item my cotrol fire and destroy all session... disaster...
its possible to bind all ajax avent for block the destroy session?
my js.file
======================================
var validNavigation = false;
/* No HTML output is returned*/
function endSession() {
//$.get("../logout.aspx");
alert("MedOFFICEweb - Sessione terminata.");
validNavigation = false
}
function wireUpEvents() {
/*
* For a list of events that triggers onbeforeunload on IE
* check http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx
*/
window.onbeforeunload = function() {
if (!validNavigation) {
endSession();
}
}
// Attach the event click for all links in the page
$("a").bind("click", function() {
validNavigation = true;
//alert("a")
});
// Attach the event submit for all forms in the page
$("form").bind("submit", function() {
validNavigation = true;
//alert("form")
});
}
// Wire up the events as soon as the DOM tree is ready
$(document).ready(function() {
wireUpEvents();
});
===========================================
i have a .js file to control when a user close the browser tab then destroy all session on the server.
This control when not fire when change the page with a link 'a' or submit a form else the control will fire.
I have a listbox ajaxed and when i click an item my cotrol fire and destroy all session... disaster...
its possible to bind all ajax avent for block the destroy session?
my js.file
======================================
var validNavigation = false;
/* No HTML output is returned*/
function endSession() {
//$.get("../logout.aspx");
alert("MedOFFICEweb - Sessione terminata.");
validNavigation = false
}
function wireUpEvents() {
/*
* For a list of events that triggers onbeforeunload on IE
* check http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx
*/
window.onbeforeunload = function() {
if (!validNavigation) {
endSession();
}
}
// Attach the event click for all links in the page
$("a").bind("click", function() {
validNavigation = true;
//alert("a")
});
// Attach the event submit for all forms in the page
$("form").bind("submit", function() {
validNavigation = true;
//alert("form")
});
}
// Wire up the events as soon as the DOM tree is ready
$(document).ready(function() {
wireUpEvents();
});
===========================================