-
Notifications
You must be signed in to change notification settings - Fork 130
Description
Library used
paypal-js
🐞 Describe the Bug
PayPal JS SDK causes “Permissions policy violation: unload is not allowed in this document” in Chrome
🔬 Minimal Reproduction
I’m using the official PayPal JS SDK, loaded directly from:
https://www.paypal.com/sdk/js?client-id=MY_CLIENT_ID&components=messages&enable-funding=paylater
When the script loads, Chrome DevTools repeatedly shows this warning:
[Violation] Permissions policy violation: unload is not allowed in this document
This happens because the SDK attaches an unload event listener:
window.addEventListener("unload", ...)
Newer browser versions block the unload event unless explicitly permitted by the Permissions Policy. Since the SDK is loaded remotely, I cannot modify or remove this handler.
This warning appears even with a minimal integration (no iframes, default settings, standard usage).
The issue is cosmetic but makes debugging difficult, and it may break in stricter browser environments.
🤔 Expected Behavior
The SDK should avoid registering event listeners that violate the Permissions Policy in modern browsers.
Ideally, PayPal would remove the unload handler or replace it with a permitted event (pagehide or visibilitychange).
Could you please:
- Confirm this is a known issue with the current JS SDK version
- Provide a fix or workaround
- Escalate to the SDK engineering team if necessary
- Advise if a version of the SDK without unload listeners is available
Thank you.
🌍 Environment
Browser: Version 142.0.7444.163 (Official Build) (64-bit)
SDK version: Latest (loaded from paypal.com)