When I am closing my browser I want a confirmation message.
I am using
window.onbeforeunload = confirmExit;
function confirmExit() {
return "You will Lost this test. Are you sure you want to exit this page?";
}
function confirmExit() {
return "You will Lost this test. Are you sure you want to exit this page?";
}
But this function is also working on page postback on my page.
I want this message on window cclose only
What should I have to do.????

Khargesh RajputPosted Nov 20, 2014, 11:06 PM
use
OnClientClick="needToConfirm = false;" on controls on page
and
javascript fun is
Khargesh RajputPosted Nov 11, 2014, 4:04 AM
Joginder BangerPosted Nov 11, 2014, 3:57 AM
$(window).unload(function() {
var answer = confirm("Are you sure?")
if (answer){
alert("Bye bye!") }
else{ alert("Thanks for sticking around!") }
});