diff --git a/js/app/studs.js b/js/app/studs.js
index 816f81410c07c738ae93cec8bd7a762f8e0da402..45ef0a6f0254981dcb8793dfa8bdf728533983cd 100644
--- a/js/app/studs.js
+++ b/js/app/studs.js
@@ -21,6 +21,8 @@ var form;
 
 $(document).ready(function () {
 
+    // Flag for onbeforeunload event
+    var isSubmittingVote = false;
 
     /**
      * Save a list of polls inside LocalStorage
@@ -88,6 +90,8 @@ $(document).ready(function () {
             $('html, body').animate({
                 scrollTop: messageContainer.offset().top
             }, 750);
+        } else {
+            isSubmittingVote = true;
         }
     });
 
@@ -172,6 +176,7 @@ $(document).ready(function () {
         return false;
     });
 
+
     /**
      * Disable view public results option when there's a password and the poll is not hidden
      */
@@ -182,6 +187,17 @@ $(document).ready(function () {
             $('#resultsPubliclyVisible').attr('disabled','disabled');
         }
     });
+
+    $(window).on('beforeunload', function(e) {
+        var name = $('#name').val().trim();
+        var comment = $('#comment').val().trim();
+
+        if ((!isSubmittingVote && name.length > 0) || comment.length > 0) {
+            var confirmationMessage = $('#preventLeaving').text();
+            e.returnValue = confirmationMessage;
+            return confirmationMessage;
+        }
+    });
 });
 
 
diff --git a/locale/en.json b/locale/en.json
index f6d5e9d820fcaae2dcba5ec07475e6b36f45aecf..3ad745263e64faac565a5fc3827e7d3480468a21 100644
--- a/locale/en.json
+++ b/locale/en.json
@@ -133,6 +133,7 @@
       "Failed to save poll": "Failed to save poll",
       "Forbidden!": "Forbidden!",
       "Identifier is already used": "Identifier is already used",
+      "If you quit now, your changes will be lost.": "If you quit now, your changes will be lost.",
       "JavaScript is disabled on your browser. It is required to create a poll.": "JavaScript is disabled on your browser. It is required to create a poll.",
       "Missing values": "Missing values",
       "No polls found": "No polls found",
diff --git a/locale/fr.json b/locale/fr.json
index 03877140d96d91f4526095b888d9a6b3460cabfb..0b9fc84d311c7e96e48566b0316260cb4daa5775 100644
--- a/locale/fr.json
+++ b/locale/fr.json
@@ -133,6 +133,7 @@
       "Failed to save poll": "Échec de la sauvegarde du sondage",
       "Forbidden!": "Interdit !",
       "Identifier is already used": "L'identifiant est déjà utilisé",
+      "If you quit now, your changes will be lost.": "Si vous quittez maintenant, vos modifications seront perdues.",
       "JavaScript is disabled on your browser. It is required to create a poll.": "JavaScript est désactivé sur votre navigateur. Son activation est requise pour la création d'un sondage.",
       "Missing values": "Il manque des valeurs",
       "No polls found": "Aucun sondage n'a été trouvé",
diff --git a/tpl/part/messages.tpl b/tpl/part/messages.tpl
index 2bcb7b9bbdaf84b9ce9bf3f189e3914c294cd94a..a2edb9eead3a7a6db73570dca2c6cd68d8d1ed2f 100644
--- a/tpl/part/messages.tpl
+++ b/tpl/part/messages.tpl
@@ -22,4 +22,5 @@
 </div>
 <div id="nameErrorMessage" class="hidden alert alert-dismissible alert-danger hidden-print" role="alert">{__('Error', 'The name is invalid.')}<button type="button" class="close" data-dismiss="alert" aria-label="{__('Generic', 'Close')}"><span aria-hidden="true">&times;</span></button></div>
 <div id="genericErrorTemplate" class="hidden alert alert-dismissible alert-danger hidden-print" role="alert"><span class="contents"></span><button type="button" class="close" data-dismiss="alert" aria-label="{__('Generic', 'Close')}"><span aria-hidden="true">&times;</span></button></div>
-<div id="genericUnclosableSuccessTemplate" class="hidden alert alert-success hidden-print" role="alert"><span class="contents"></span></div>
\ No newline at end of file
+<div id="genericUnclosableSuccessTemplate" class="hidden alert alert-success hidden-print" role="alert"><span class="contents"></span></div>
+<div id="preventLeaving" class="hidden hidden-print" aria-hidden="true">{__('Error', 'If you quit now, your changes will be lost.')}</div>
\ No newline at end of file