Thanks in advance
]]>I could use this routine to check if the user has left out something before closing the window. Really thank you!
]]>#I don’t think you can find out the return value. Showing the popup message is the last thing that happens in the onbeforeunload event/method, and after that, #javascript is not running any more, so you can’t do anything in your script to react to the user’s input. I’m sorry. You could do a workaround by storing the #information that the user tried to close the window BEFORE showing the message, like this:
ok but the return value is sent to where? i need that one so if we find means we can handle the allthings of browser is possible means we are done.
[email protected]
I was done task thanks for your help. And one more help if possible to handle the browser close,minimize etc in javascript or jquery if possible means i need how to handle entire browser options and properties,event
Note: All browsers to handle
]]>I don’t think you can find out the return value. Showing the popup message is the last thing that happens in the onbeforeunload event/method, and after that, javascript is not running any more, so you can’t do anything in your script to react to the user’s input. I’m sorry. You could do a workaround by storing the information that the user tried to close the window BEFORE showing the message, like this:
<html><body>
<script type="text/javascript">
triedToClose=false;
window.onbeforeunload = function() {
triedToClose = true
return "Did you save your stuff?"
}
function checkClosing() {
if (triedToClose) {
alert("user tried to close the window but changed his mind")
} else {
alert("user didn't try to close the window")
}
}
</script>
<pre>
To use:
1. click on the test link, see what happens.
2. try to close the window (browser (x)) - then select "stay on page"
3. click on the test link again - see that the message changed.
<a href="#" onclick="checkClosing()" rel="nofollow">Some test link</a>
</pre></body></html>
Please note that you can only evaluate the result if the user performs some action on your page, such as clicking on the test link. You would need to add the checkClosing() call to all your links and buttons and could even add it to the onbeforeunload function itself. not very elegant but the best I can do.
Hope this helps!
]]>var confirmclose = true;
var sucess = false;
var ajaxSubmit = false;
function closeSession(){
if(confirmclose) {
return “close”;
}
}
window.onbeforeunload = closeSession;
Google
fewfwef
–>
]]>function closeSession(){
if(confirmclose) {
return “close”; i want to find retrun value and tehn use ajax function to update isActive field in user table
}
}
window.onbeforeunload = closeSession;
fewfwef
i need all these happen only when browser close [x] is clicked
]]>function closeSession(evt){
if(confirmClose){
return ‘Bharani’; i want to find retrun value and tehn use ajax function to update isActive field in user table
}
}
window.onbeforeunload = closeSession;
<!– doSomething(event);–>
i need all these happen only when browser close [x] is clicked
]]>if the possible to find retrun value to call the ajax function
]]> function closeSession() {
//alert(confirmClose);
if (confirmClose) {
//if (confirm(‘Are you want to close the page?’)) {
////alert(‘/Login.aspx/hostoruser_Logout’);
//} else { return; }
return test();
}
}
var sucess = false;
var ajaxSubmit = false;
function test() {
if (sucess == true)
return “Are you want to close the page?”;
if (ajaxSubmit == false) {
ajaxSubmit = true;
$.ajax({
asyn: false,
url: ‘/BrowserClose.aspx’,
type: ‘Post’,
data: {},
contentType: “application/json; charset=utf-8″,
dataType: “json”,
success: function (msg) {
//alert(‘sucess’);
sucess = true;
},
error: function (xhr, ajaxOptions, thrownError) {
//alert(xhr.status);
//alert(xhr.statusText);
//alert(thrownError);
}
});
}
setTimeout(test(), 200);
}
window.onbeforeunload = closeSession;
this is code right now i use but it says “Too much of recursion”
]]>