akamai / boomerang

End user oriented web performance testing and beaconing
http://akamai.github.io/boomerang/
Other
1.86k stars 292 forks source link

disable page unload beacon #347

Open iwindfree opened 1 year ago

iwindfree commented 1 year ago

Hi, thank's to boomerang script contributors. It's a great script..

I have a two question. one, Is there a way to disable page unload beacon?

two, for web vital score, Does cumulative shift layout (CLS) usually happen before page load event end?

Currently, in order to measure CLS, I set 'afteronload' option of continunity pluin to true and collect cls score from the page unload beacon. If CLS usually happen before page load event end, I will collect CLS from page load beacon not unload beacon.

thanks in advance.

mems commented 1 year ago

Also note that:

The most important way to optimize for bfcache in all browsers is to never use the unload event. Ever!

[...]

Instead of using the unload event, use the pagehide event. The pagehide event fires in all cases where the unload event currently fires, and it also fires when a page is put in the bfcache.

Back/forward cache

bluesmoon commented 1 year ago

@mems boomerang doesn't attach to the unload event except for really old browsers that don't have bfcache. The boomerang unload event is the browser's beforeunload or pagehide event.