<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[56809] trunk/src: Administration: Remove deprecated `unload` event handlers and use `pagehide` (and `pageshow`) when appropriate.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/56809">56809</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/56809","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>westonruter</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-10-09 21:29:42 +0000 (Mon, 09 Oct 2023)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Administration: Remove deprecated `unload` event handlers and use `pagehide` (and `pageshow`) when appropriate.

Use `pagehide` event instead of `unload` in the following cases:

* For classic editor to release the post lock.
* In Text widget to rebuild editor after dragging widget to new location in classic widgets interface.
* To clear out the `window.name` when navigating away from a post preview.
* To suspend heartbeat, while also using `pageshow` event to resume as if it had been a focused tab in case page restored from bfcache. 

Also:

* Remove obsolete mobile cleanup code in `js/_enqueues/lib/gallery.js` (introduced in <a href="https://core.trac.wordpress.org/changeset/9894">[9894]</a>). Do same for `src/js/_enqueues/wp/media/models.js` (introduced in <a href="https://core.trac.wordpress.org/changeset/22872">[22872]</a>). See <a href="https://core.trac.wordpress.org/ticket/22552">#22552</a>.
* Remove obsolete Firefox-specific workaround in `js/_enqueues/wp/mce-view.js` from <a href="https://core.trac.wordpress.org/changeset/39282">[39282]</a>. See <a href="https://core.trac.wordpress.org/ticket/38511">#38511</a>.

Fixes <a href="https://core.trac.wordpress.org/ticket/55491">#55491</a>.
Props spenserhale, westonruter, adamsilverstein, azaozz, shawfactor, peterwilsoncc, swissspidy.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcjs_enqueuesadminpostjs">trunk/src/js/_enqueues/admin/post.js</a></li>
<li><a href="#trunksrcjs_enqueueslibgalleryjs">trunk/src/js/_enqueues/lib/gallery.js</a></li>
<li><a href="#trunksrcjs_enqueueswpheartbeatjs">trunk/src/js/_enqueues/wp/heartbeat.js</a></li>
<li><a href="#trunksrcjs_enqueueswpmceviewjs">trunk/src/js/_enqueues/wp/mce-view.js</a></li>
<li><a href="#trunksrcjs_enqueueswpmediamodelsjs">trunk/src/js/_enqueues/wp/media/models.js</a></li>
<li><a href="#trunksrcjs_enqueueswpwidgetstextjs">trunk/src/js/_enqueues/wp/widgets/text.js</a></li>
<li><a href="#trunksrcwpincludesfunctionsphp">trunk/src/wp-includes/functions.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcjs_enqueuesadminpostjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/js/_enqueues/admin/post.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/js/_enqueues/admin/post.js      2023-10-09 17:21:30 UTC (rev 56808)
+++ trunk/src/js/_enqueues/admin/post.js        2023-10-09 21:29:42 UTC (rev 56809)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -511,7 +511,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        // See https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event.
</span><span class="cx" style="display: block; padding: 0 10px">                        return __( 'The changes you made will be lost if you navigate away from this page.' );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        }).on( 'unload.edit-post', function( event ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ }).on( 'pagehide.edit-post', function( event ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 if ( ! releaseLock ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        return;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span></span></pre></div>
<a id="trunksrcjs_enqueueslibgalleryjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/js/_enqueues/lib/gallery.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/js/_enqueues/lib/gallery.js     2023-10-09 17:21:30 UTC (rev 56808)
+++ trunk/src/js/_enqueues/lib/gallery.js       2023-10-09 21:29:42 UTC (rev 56809)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -88,8 +88,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> });
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-jQuery(window).on( 'unload', function () { window.tinymce = window.tinyMCE = window.wpgallery = null; } ); // Cleanup.
-
</del><span class="cx" style="display: block; padding: 0 10px"> /* gallery settings */
</span><span class="cx" style="display: block; padding: 0 10px"> window.tinymce = null;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcjs_enqueueswpheartbeatjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/js/_enqueues/wp/heartbeat.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/js/_enqueues/wp/heartbeat.js    2023-10-09 17:21:30 UTC (rev 56808)
+++ trunk/src/js/_enqueues/wp/heartbeat.js      2023-10-09 21:29:42 UTC (rev 56809)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -223,9 +223,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                settings.checkFocusTimer = window.setInterval( checkFocus, 10000 );
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $(window).on( 'unload.wp-heartbeat', function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $(window).on( 'pagehide.wp-heartbeat', function() {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 // Don't connect anymore.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                settings.suspend = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         suspend();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                // Abort the last request if not completed.
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( settings.xhr && settings.xhr.readyState !== 4 ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -233,6 +233,25 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px">                        });
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        $(window).on(
+                               'pageshow.wp-heartbeat',
+                               /**
+                                * Handles pageshow event, specifically when page navigation is restored from back/forward cache.
+                                *
+                                * @param {jQuery.Event} event
+                                * @param {PageTransitionEvent} event.originalEvent
+                                */
+                               function ( event ) {
+                                       if ( event.originalEvent.persisted ) {
+                                               /*
+                                                * When page navigation is stored via bfcache (Back/Forward Cache), consider this the same as
+                                                * if the user had just switched to the tab since the behavior is similar.
+                                                */
+                                               focused();
+                                       }
+                               }
+                       );
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         // Check for user activity every 30 seconds.
</span><span class="cx" style="display: block; padding: 0 10px">                        window.setInterval( checkUserActivity, 30000 );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -541,7 +560,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        settings.userActivity = time();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        // Resume if suspended.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        settings.suspend = false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 resume();
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( ! settings.hasFocus ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                settings.hasFocus = true;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -550,6 +569,20 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 * Suspends connecting.
+                */
+               function suspend() {
+                       settings.suspend = true;
+               }
+
+               /**
+                * Resumes connecting.
+                */
+               function resume() {
+                       settings.suspend = false;
+               }
+
+               /**
</ins><span class="cx" style="display: block; padding: 0 10px">                  * Runs when the user becomes active after a period of inactivity.
</span><span class="cx" style="display: block; padding: 0 10px">                 *
</span><span class="cx" style="display: block; padding: 0 10px">                 * @since 3.6.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -593,7 +626,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        // Suspend after 10 minutes of inactivity when suspending is enabled.
</span><span class="cx" style="display: block; padding: 0 10px">                        // Always suspend after 60 minutes of inactivity. This will release the post lock, etc.
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( ( settings.suspendEnabled && lastActive > 600000 ) || lastActive > 3600000 ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                settings.suspend = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         suspend();
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( ! settings.userActivityEvents ) {
</span></span></pre></div>
<a id="trunksrcjs_enqueueswpmceviewjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/js/_enqueues/wp/mce-view.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/js/_enqueues/wp/mce-view.js     2023-10-09 17:21:30 UTC (rev 56808)
+++ trunk/src/js/_enqueues/wp/mce-view.js       2023-10-09 21:29:42 UTC (rev 56809)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -643,16 +643,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        }, 3000 );
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                function reload() {
-                                       if ( ! editor.isHidden() ) {
-                                               $( node ).data( 'rendered', null );
-
-                                               setTimeout( function() {
-                                                       wp.mce.views.render();
-                                               } );
-                                       }
-                               }
-
</del><span class="cx" style="display: block; padding: 0 10px">                                 function addObserver() {
</span><span class="cx" style="display: block; padding: 0 10px">                                        observer = new MutationObserver( _.debounce( resize, 100 ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -663,7 +653,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                        } );
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $( iframeWin ).on( 'load', resize ).on( 'unload', reload );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $( iframeWin ).on( 'load', resize );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                MutationObserver = iframeWin.MutationObserver || iframeWin.WebKitMutationObserver || iframeWin.MozMutationObserver;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcjs_enqueueswpmediamodelsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/js/_enqueues/wp/media/models.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/js/_enqueues/wp/media/models.js 2023-10-09 17:21:30 UTC (rev 56808)
+++ trunk/src/js/_enqueues/wp/media/models.js   2023-10-09 21:29:42 UTC (rev 56809)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,8 +2,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @output wp-includes/js/media-models.js
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-var $ = jQuery,
-       Attachment, Attachments, l10n, media;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+var Attachment, Attachments, l10n, media;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /** @namespace wp */
</span><span class="cx" style="display: block; padding: 0 10px"> window.wp = window.wp || {};
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -237,8 +236,3 @@
</span><span class="cx" style="display: block; padding: 0 10px">                props: _.extend( _.defaults( props || {}, { orderby: 'date' } ), { query: true } )
</span><span class="cx" style="display: block; padding: 0 10px">        });
</span><span class="cx" style="display: block; padding: 0 10px"> };
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-// Clean up. Prevents mobile browsers caching.
-$(window).on('unload', function(){
-       window.wp = null;
-});
</del></span></pre></div>
<a id="trunksrcjs_enqueueswpwidgetstextjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/js/_enqueues/wp/widgets/text.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/js/_enqueues/wp/widgets/text.js 2023-10-09 17:21:30 UTC (rev 56808)
+++ trunk/src/js/_enqueues/wp/widgets/text.js   2023-10-09 21:29:42 UTC (rev 56809)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -291,7 +291,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                onInit = function() {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                        // When a widget is moved in the DOM the dynamically-created TinyMCE iframe will be destroyed and has to be re-built.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        $( editor.getWin() ).on( 'unload', function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 $( editor.getWin() ).on( 'pagehide', function() {
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 _.defer( buildEditor );
</span><span class="cx" style="display: block; padding: 0 10px">                                        });
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunksrcwpincludesfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/functions.php       2023-10-09 17:21:30 UTC (rev 56808)
+++ trunk/src/wp-includes/functions.php 2023-10-09 21:29:42 UTC (rev 56809)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7585,7 +7585,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Outputs a small JS snippet on preview tabs/windows to remove `window.name` on unload.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Outputs a small JS snippet on preview tabs/windows to remove `window.name` when a user is navigating to another page.
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * This prevents reusing the same tab for a preview when the user has navigated away.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -7614,7 +7614,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( window.addEventListener ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        window.addEventListener( 'unload', function() { window.name = ''; }, false );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 window.addEventListener( 'pagehide', function() { window.name = ''; } );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">        }());
</span><span class="cx" style="display: block; padding: 0 10px">        </script>
</span></span></pre>
</div>
</div>

</body>
</html>