Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function setConfirmUnload(on) {
- window.onbeforeunload = (on) ? unloadMessage : null;
- }
- function unloadMessage() {
- return 'You have entered new data on this page. If you navigate away from this page without first saving your data, the changes will be lost.';
- }
- $(document).ready(function() {
- $(':input',document.myForm).bind("change", function() { setConfirmUnload(true); }); // Prevent accidental navigation away
- });
- 300 jQuery(window).unload(function(e) {
- 301 var chg = jQuery(".crayon-changed");
- 302 if (chg.length && uniConfirm(configCrayons.txt.sauvegarder)) {
- 303 chg.next().find('form').submit();
- 304 }
- 305 });
- jQuery(window).bind('beforeunload', function(event) {
- event.stopPropagation();
- event.returnValue = "Attention !nVous n'avez pas sauver vos paramètres.nSi vous appuyer sur OK, vous perdrez les informations en cours d'utilisation...nnLa fenêtre est sur le point de se fermer";
- return event.returnValue;
- });
Add Comment
Please, Sign In to add comment