X
Publisher: Sigit purnomo kangsigit.com@gmail.com

JavaScript – Confirm Before Window is Closed


Today I will try to explain a little basic script to confirm a warning when the browser is closed or reload. I think the trick as it is commonly used for websites that form filed and will appear when someone tried to run away before completing the charging data.
However, to create a memorial as it not only can be done when the session is not closed. Let's look at the codes:
window.onbeforeunload = function (example) {
   example = example || window.event;
   // For IE and Firefox prior to version 4
   if (example) {
      example.returnValue = 'Are you sure you want to closing Askedboss.com?';
   }
   // For Safari, Chrome
   return 'Are you sure you want to closing Askedboss.com?';
};
For example, please click the close button in this window then a warning will appear.!!

Advertisement

JavaScript – Confirm Before Window is Closed
Add Comments
0 Comments
Click Here to Add Comments

No Comment