diff --git a/resources/vue/components/WikiEditor.vue b/resources/vue/components/WikiEditor.vue
index 6aae50c275d5857d6b9a406ca0eb70257d4fdad0..52290cde2d9399178ede6acfd4a283296bb63bda 100644
--- a/resources/vue/components/WikiEditor.vue
+++ b/resources/vue/components/WikiEditor.vue
@@ -182,12 +182,17 @@ export default {
                 online: this.isOnlineAndEditing
             };
 
-            if (this.isChanged) {
+            if (this.autosave && this.isChanged) {
                 data.content = this.editor.getData();
                 this.isChanged = false;
             }
 
             return data;
+        },
+        securityHandler(event) {
+            event.preventDefault();
+
+            event.returnValue = true;
         }
     },
     mounted() {
@@ -195,9 +200,7 @@ export default {
 
         STUDIP.wysiwyg.replace(textarea).then((editor) => {
             editor.model.document.on('change:data', () => {
-                if (this.autosave) {
-                    this.isChanged = true;
-                }
+                this.isChanged = editor.getData() !== this.content;
             });
 
             if (this.isEditing) {
@@ -227,6 +230,15 @@ export default {
             },
             () => this.getUpdaterData()
         )
+    },
+    watch: {
+        isChanged(current) {
+            if (current) {
+                window.addEventListener('beforeunload', this.securityHandler);
+            } else {
+                window.removeEventListener('beforeunload', this.securityHandler);
+            }
+        }
     }
 }
 </script>