Skip to content

[Bug] Permissions policy violation: unload is not allowed in this document #741

@aleksandrtoroshchin

Description

@aleksandrtoroshchin

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions