1

I've less knowledge on JavaScript/JQuery I got snippet to get alert when i press browser 'X' button. code is below,

window.onbeforeunload = function (e) {
 if(unsavedState){
   e = e || window.event;
   if (e) 
    e.returnValue = 'Data you have entered may not be saved.';
   return 'Data you have entered may not be saved.';
 }
};

But the problem is customer not happy with the browser giving pop-up he want custom pop-up, when i change any thing in the above code that is not working. Please help on this. browser are Firefox, Chrome and IE 8 and above. I'm attaching Screenshot(Firefox). Thanks. enter image description here

Rajesh Narravula
  • 1,433
  • 3
  • 26
  • 54

1 Answers1

1

I don't think you can customize it anymore than you already have. Otherwise, it would be a security/privacy risk on the part of the browsers. Think about it... no website wants its users to leave, so what would stop all websites from maliciously stopping people from leaving by looping through endless "custom" popups? The boring popup you have displayed in your original question is to ensure that the user knows what they are being asked.

Short answer: you can't do what you're asking.

JasonJensenDev
  • 2,377
  • 21
  • 30