While using pdf.js 4.4.168 to display PDF files in the browser, I encountered an error when trying to open the site in Safari 16.4:
Unexpected Application Error!
Promise.withResolvers is not a function. (In 'Promise.withResolvers()', 'Promise.withResolvers' is undefined)
x_@https://tex.poemhub.top/assets/index--WBBKURE.js:35:156906
sV@https://tex.poemhub.top/assets/index--WBBKURE.js:35:152952
@https://tex.poemhub.top/assets/index--WBBKURE.js:45:77451
yl@https://tex.poemhub.top/assets/react-BFk0LVKl.js:32:24264
ur@https://tex.poemhub.top/assets/react-BFk0LVKl.js:32:42277
@https://tex.poemhub.top/assets/react-BFk0LVKl.js:32:40631
P@https://tex.poemhub.top/assets/react-BFk0LVKl.js:17:1585
oe@https://tex.poemhub.top/assets/react-BFk0LVKl.js:17:1954
After researching online, I found out that older browsers do not support Promise.withResolvers(), which requires us to upgrade the browser to resolve this issue. However, I still wanted users with older browser versions to be able to access the website. So, I attempted to switch to the legacy version of pdf.js. To do so, I downloaded the legacy version and replaced it with the current one from here: https://github.com/mozilla/pdf.js/releases/download/v4.4.168/pdfjs-4.4.168-legacy-dist.zip.
Even after replacing the pdf.worker.min.mjs
file, the issue persisted. Here is the link to my legacy js file: . Am I overlooking something? What steps should I take to address this problem?