[Bug]: PDF.js v4.9.155 Not Working on Safari (macOS) with legacy build #19348
Unanswered
harishfalco
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Attach (recommended) or Link to PDF file
Issue: PDF.js v4.9.155 Not Working on Safari (macOS)
Problem Description
The
4.9.155
version of PDF.js does not function properly on Safari (macOS). After loading thepdf.mjs
file from thegeneric-legacy
build, the following error appears in the Safari console:SyntaxError: Unexpected token '{'
This error seems to stem from Safari's lack of support for static class fields, a feature introduced in ES2022. This is unexpected since the legacy build is supposed to ensure compatibility with older browsers.
Steps Taken
Followed the Building PDF.js section in the README.
pdf.mjs
file from the legacy build into the project.Despite these steps, the error persists on Safari when attempting to render PDFs.
Observed Behavior
The legacy build includes modern JavaScript features, such as static class fields, which are unsupported by Safari. This contradicts the purpose of the legacy build.
Error Screenshots
Code Snippet
HTML
Javscript
Previous Research
Questions
Web browser and its version
Safari (on Mac) and Version : 16.3 (18614.4.6.1.6)
Operating system and its version
MacOS , version : 13.2.1 (22D68)
PDF.js version
4.9.155
Is the bug present in the latest PDF.js version?
Yes
Is a browser extension
No
Steps to reproduce the problem
Beta Was this translation helpful? Give feedback.
All reactions