payloadcms / payloadcms/payload

PDF not loading in live preview on Chrome

Open
#16,407 0 comments 0 reactions 1 assignee View on GitHub

@jacobsfletch is already working on this.

Since May 4, 2026.

area: live-preview v3
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

Because of this line sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-modals allow-downloads" on the iframe, Chrome doesn't load any PDFs inside of the live preview.

I use Payload to generate and preview PDFs which is no longer working after updating Payload.

https://github.com/payloadcms/payload/commit/167a01e#diff-8a3bcd413d0082f04c10fbe1f1fe9e4bde1dbafee782b359012164fdea16216dR122

I also noticed a warning in the console:

"An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing."

Link to the code that reproduces this issue

https://github.com/LeanderG/payload

Reproduction Steps
  1. Run pnpm dev _community in the repo.
  2. Open an item on http://localhost:3000/admin/collections/pdf-preview
  3. The PDF does not load in Chrome and shows the message "This page has been blocked by Chrome" instead.
Which area(s) are affected?

area: live-preview

Environment Info
Binaries:
  Node: 24.14.1
  npm: 11.11.0
  Yarn: N/A
  pnpm: 10.27.0
Relevant Packages:
  payload: 3.84.1
  next: 16.2.3
  @payloadcms/db-postgres: 4.0.0-beta.0
  @payloadcms/live-preview-react: 4.0.0-beta.0
  @payloadcms/typescript-plugin: 4.0.0-beta.0
  react: 19.2.4
  react-dom: 19.2.4
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:56:35 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 12

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.