-
Notifications
You must be signed in to change notification settings - Fork 155
Description
Hey AMP/worker-dom team,
At Permutive, we've been using the sandboxed
mode of amp-script for our script. The change to support this in worker-dom was introduced in #1042
One request we had and that I was discussing with @samouri is the ability to detect a page unload event.
Right now, in sandboxed mode we cannot attach any event listeners, and this is understandable based on the restrictions that the sandboxed
mode places on scripts running within it.
However, I was wondering if we can allow an event listener to be attached for a page unload event. Based on our cross device testing we currently use the pagehide
event on desktop and visibilitychange
for mobile.
I was wondering if we can get access to both while our script is running in sandboxed mode?
Use Case
In response to a page unload event, we wish to be able to send a beacon request with some engagement related metrics from the page.
Thanks!