From 4163263b011d42c840e5a3c7deee317bdae6e2cd Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Tue, 5 Apr 2016 17:59:20 -0400 Subject: [PATCH] Ignore beforeunload event return value Instead of using it as the message to show to the user, simply compare it against the empty string or not. This matches Gecko, WebKit, and Blink (but not yet EdgeHTML). Closes #952. --- source | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/source b/source index 589796ed68d..f2922b21dc9 100644 --- a/source +++ b/source @@ -35736,7 +35736,7 @@ sfx.oncanplaythrough = function () { // meow when the user tries to leave window.onbeforeunload = function () { playSound('kitten mew'); - return 'Are you sure you want to leave this awesome page?'; + return true; } @@ -82198,9 +82198,9 @@ dictionary PageTransitionEventInit : EventInit { object is not the empty string, or if the event was canceled, then the user agent should ask the user to confirm that they wish to unload the document.

-

The prompt shown by the user agent may include the string of the returnValue attribute, optionally truncated.

+

The message shown to the user is not customizable, but instead determined by + the user agent. In particular, the actual value of the returnValue attribute is ignored.

The user agent must pause while waiting for the user's response.

@@ -82377,13 +82377,14 @@ dictionary PageTransitionEventInit : EventInit {
-
event . returnValue [ = value ]
+
event . returnValue [ = " " ]

Returns the current return value of the event (the message to show the user).

-

Can be set, to update the message.

+

Can be set, to request that the user agent to confirm with the user their intention to + unload the document. Any value besides the empty string will suffice for this purpose.

@@ -82394,10 +82395,15 @@ dictionary PageTransitionEventInit : EventInit {

The returnValue attribute - represents the message to show the user. When the event is created, the attribute must be set to + controls the process of prompting to unload the + document. When the event is created, the attribute must be set to the empty string. On getting, it must return the last value it was set to. On setting, the attribute must be set to the new value.

+

This attribute is a DOMString only for historical reasons. + Any value besides the empty string will be treated as a request to ask the user for + confirmation.

+
@@ -86996,7 +87002,7 @@ typedef EventHandlerNonNull? EventHandler; as described above, if the return value is false, the event is canceled (except for mouseover events, where the return value has to be true to cancel the event). With beforeunload events, - the value is instead used to determine the message to show the user.

+ the value is instead used to determine whether or not to prompt about unloading the document.

For historical reasons, the onerror handler has different arguments: