var isTouched = false; // make isTouched variable true by any activity, like any input text changed window.addEventListener("beforeunload", function (e) { if (isTouched) { var confirmationMessage = 'Changes you made may not be saved.'; (e || window.event).returnValue = confirmationMessage; return confirmationMessage; } });
+1
1
+1
+1
+1
+1
+1
+1