diff --git a/core/modules/saver-handler.js b/core/modules/saver-handler.js index 0669ec917..3344495c7 100644 --- a/core/modules/saver-handler.js +++ b/core/modules/saver-handler.js @@ -75,14 +75,14 @@ function SaverHandler(options) { } }); // Set up our beforeunload handler - window.addEventListener("beforeunload",function(event) { + window.onbeforeunload = function(event) { var confirmationMessage; if(self.isDirty()) { confirmationMessage = $tw.language.getString("UnsavedChangesWarning"); event.returnValue = confirmationMessage; // Gecko } return confirmationMessage; - }); + }; } // Install the save action handlers if($tw.browser) { diff --git a/core/modules/syncer.js b/core/modules/syncer.js index 08d5deb19..617c54155 100644 --- a/core/modules/syncer.js +++ b/core/modules/syncer.js @@ -39,14 +39,14 @@ function Syncer(options) { // Browser event handlers if($tw.browser) { // Set up our beforeunload handler - window.addEventListener("beforeunload",function(event) { + window.onbeforeunload = function(event) { var confirmationMessage; if(self.isDirty()) { confirmationMessage = $tw.language.getString("UnsavedChangesWarning"); event.returnValue = confirmationMessage; // Gecko } return confirmationMessage; - }); + }; // Listen out for login/logout/refresh events in the browser $tw.rootWidget.addEventListener("tm-login",function() { self.handleLoginEvent();