HI
I wanna timeout session from client page,i tried below code but not able to execute code need some help of how i can handle OK or CANCEL events from user
onbeforeunload
must return a string, the browser creates the confirm box from that string. If you want to capture that the user didn't leave (You cannot run anything if the user left, thats just how it is), simply set a timer and see if it fires:
window.onbeforeunload = function(){
setTimeout(function(){
//User didnt leave
goDoFunStuff();
},500);
return 'wanna go?'
}
Since onbeforeunload
is blocking the timer will only fire if the user didnt leave