Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Support for page unload detection in sandboxed mode #1128

Open
zshnr opened this issue Jan 17, 2022 · 0 comments
Open

[Feature Request] Support for page unload detection in sandboxed mode #1128

zshnr opened this issue Jan 17, 2022 · 0 comments

Comments

@zshnr
Copy link

zshnr commented Jan 17, 2022

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant