84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
This is the solution I use in situations where I need to perform some action (such as clearing the session) when the user navigates from the page.
I have 2 global variables
var clearSession = true; var confirmExit = true; window.onbeforeunload = function() { return confirmExit(); } window.onunload = function() { return clearSession(); } function confirmExit() { if (needToConfirm == true) { return "退出页面?"; } } function clearSession() { if (clearSession == true) { alert("在服务器上终止会话!!!"); PageMethods.ClearSession(); } }
Then when each page submits/button/dropdown etc you need to make sure the above global variable is set to false.
Hope it helps someone.
This is the solution I use in situations where I need to perform some action (such as clearing the session) when the user navigates from the page.
I have 2 global variables
Then when each page submits/button/dropdown etc you need to make sure the above global variable is set to false.
Hope it helps someone.