[wp-trac] [WordPress Trac] #14356: Better string for onbeforeunload event dialog

WordPress Trac noreply at wordpress.org
Mon Jul 16 16:37:46 UTC 2018


#14356: Better string for onbeforeunload event dialog
-------------------------------------+-------------------------------------
 Reporter:  demetris                 |       Owner:  adamsilverstein
     Type:  enhancement              |      Status:  assigned
 Priority:  low                      |   Milestone:  4.9.8
Component:  Editor                   |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-ux-feedback dev-     |     Focuses:  javascript,
  feedback has-patch i18n-change     |  administration
  needs-testing                      |
-------------------------------------+-------------------------------------

Comment (by birgire):

 I was trying to test the patch in Chrome, but always got the same dialog
 as shown in [attachment:"leave-site-dialog-in-chrome.jpg"], without custom
 messages.

 The reason seems to be that it's no longer available in Chrome 51+ to
 modify the message of that dialog:

 > **TL;DR:** A window's onbeforeunload property no longer supports a
 custom string.
 >
 > A window’s {{{onbeforeunload}}} property may be set to a function that
 returns a string that is shown to
 > the user in a dialog box to confirm that the user wants to navigate
 away. This was intended to
 > prevent users from losing data during navigation. Unfortunately, it is
 often used to scam users.
 >
 > Starting in Chrome 51, a custom string will no longer be shown to the
 user. Chrome will still show a
 > dialog to prevent users from losing data, but it's contents will be set
 by the browser instead of the
 > web page.
 >
 > With this change, Chrome will be consistent with Safari 9.1 and later,
 as well as Firefox 4 and
 > later.

 https://developers.google.com/web/updates/2016/04/chrome-51-deprecations

 If the same goes for Safari 9.1+ and Firefox 4+, as mentioned there, I
 wonder what browsers still support this?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/14356#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list