diff --git a/lib/gollum/frontend/public/gollum/javascript/gollum.js b/lib/gollum/frontend/public/gollum/javascript/gollum.js
index <HASH>..<HASH> 100755
--- a/lib/gollum/frontend/public/gollum/javascript/gollum.js
+++ b/lib/gollum/frontend/public/gollum/javascript/gollum.js
@@ -214,14 +214,18 @@ $(document).ready(function() {
   }
 
   if( $('#wiki-wrapper.edit').length ){
-    window.onbeforeunload = function(){ return "Leaving will discard all edits!" };
     $("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
+    $("#gollum-editor-body").one('change', function(){
+      window.onbeforeunload = function(){ return "Leaving will discard all edits!" };
+    });
     $.GollumEditor();
   }
 
   if( $('#wiki-wrapper.create').length ){
-    window.onbeforeunload = function(){ return "Leaving will not create a new page!" };
     $("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
+    $("#gollum-editor-body").one('change', function(){
+      window.onbeforeunload = function(){ return "Leaving will not create a new page!" };
+    )};
     $.GollumEditor({ NewFile: true, MarkupType: '{{default_markup}}' });
   }
 });
Attach unsaved changes warning to trigger only after changes are made