]> khamidou — GitHub mirrors - electron.git/commitdiff
Update browser-window.md
authorEran Tiktin <etiktin@users.noreply.github.com>
Tue, 18 Aug 2015 16:34:14 +0000 (19:34 +0300)
committerEran Tiktin <etiktin@users.noreply.github.com>
Tue, 18 Aug 2015 16:34:14 +0000 (19:34 +0300)
Update the `beforeunload` example to use `e.returnValue = false` instead of `return false`, since `e.returnValue` always works while the `return` works only in certain conditions. See #2481 for details.

docs/api/browser-window.md

index 612b3ce4f3f06eb07ae7144180ffb43f35792db7..dda22e586674c02afdb50c4abe5d508ff74ef7bc 100644 (file)
@@ -141,7 +141,7 @@ window.onbeforeunload = function(e) {
   // prompted to confirm the page unload, Electron gives developers more options.
   // Returning empty string or false would prevent the unloading now.
   // You can also use the dialog API to let the user confirm closing the application.
-  return false;
+  e.returnValue = false;
 };
 ```