[wp-trac] [WordPress Trac] #55491: Replace `unload` event handlers from core

WordPress Trac noreply at wordpress.org
Sun Oct 8 22:57:34 UTC 2023


#55491: Replace `unload` event handlers from core
----------------------------+--------------------------------------
 Reporter:  shawfactor      |       Owner:  westonruter
     Type:  defect (bug)    |      Status:  accepted
 Priority:  normal          |   Milestone:  6.4
Component:  Administration  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:  javascript, performance
----------------------------+--------------------------------------

Comment (by westonruter):

 Replying to [comment:41 shawfactor]:
 > I’m not sure you are right that it’s disabled for all authenticated
 requests. Is it nocache_headers() that preventing it? AFAICT that’s only
 called on the back end, heartbeat is used by alot of plugins on the front?
 Maybe I’ve missed in the code

 As of #21938 for WordPress 6.3, all authenticated requests get sent
 `Cache-Control: no-store`. This disables bfcache, just as an `unload`
 event listener does.

 > Secondly regardless of the answer that is be default, many people
 override the headers

 True, but in any case, my query of HTTP Archive shows it will have minimal
 impact on bfcache being disabled, since a tiny percentage of pages have
 the heartbeat script.

 > Finally chrome are on the path to deprecate the unload event anyway:
 > https://developer.chrome.com/blog/deprecating-unload/

 I'm not disagreeing that it needs to be done. It's just I don't see how
 it'll have any meaningful impact for bfcache on the web as a whole.

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


More information about the wp-trac mailing list