Skip to content

Commit

Permalink
Fix unload event used in core Javascript (#2812)
Browse files Browse the repository at this point in the history
* Switching to use pagehide vs deprecated unload event.
  • Loading branch information
brianhogg authored Dec 17, 2024
1 parent 9e528d0 commit 21f0ce2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changelogs/fix_unload-event-in-tracking.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
significance: patch
type: fixed
links:
- "#2620"
entry: Fixes Pagespeed notice regarding deprecated Javascript event usage.
2 changes: 1 addition & 1 deletion assets/js/app/llms-tracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ LLMS.Tracking = function( settings ) {
self.addEvent( 'page.load' );

window.addEventListener( 'beforeunload', onBeforeUnload );
window.addEventListener( 'unload', onUnload );
window.addEventListener( 'pagehide', onUnload );

document.addEventListener( 'visibilitychange', onVisibilityChange );

Expand Down

0 comments on commit 21f0ce2

Please sign in to comment.