PDF.js fails to display PDF on iOS Mobile Browsers

  • Application Version - e.g., OJS 3.2.1-2
  • When I click to a pdf galley link to display it, I get an error message and pdf is not displayed on my mobile phone (Safari browser).

The browser/environment lacks native support for critical functionality used by the PDF.js library (e.g. ReadableStreamand/or Promise.allSettled); please use an ES5-compatible build instead.

The situtation is same for all pdf galleys, a sample URL:

https://www.adlitipbulteni.com/atb/article/view/1400/1948

Of course, it is well displayed on desktop browsers.
There are also some other web pages talking about the same error, but I couldn’t find an answer how to fix problem.

Can you help?

Best regards,

Hi @drugurkocak,

Which version of the Safari browser is causing the problem?

Hi @Vitaliy

The iOS version is 12.4.9 on iPhone 6 plus, but I couldn’t find a way to get Safari version. According to a site, It should be version 12.
Regards,

Note: Interestingly, my phone can display pdf files of some other OJS 3.2.1-2 sites. So the issue might be specific to my installation or pdf file structure. For ex;

https://internationaljournalofwellbeing.org/index.php/ijow/article/view/951/981

IMG_0273

IMG_0274

I suspect the node.js & npm versions might be responsible for this because I well remember its version was 12 or higher. I had made a custom node.js installation on the previous domain of the same installation. I cloned the OJS files only. I faced this issue after updated to 3.2.1-2 and seperated 2 journals to independent installations.
So, it is probably a server issue :slight_smile:
I will update and look at the result
Regards,
Screen Shot 2021-01-04 at 21.40.48

It looks like the same issue report against pdf.js repo: What version is pdf.js supported with Safari on iOS? · Issue #12490 · mozilla/pdf.js · GitHub and it’s linked to the fact that starting from version 2.4.456 the support for older versions of some browsers was dropped. OJS 3.2.1 was shipped with pdf.js v. 2.5.207 and 3.2.0 with 2.0.943.

I actually uploaded and extracted -es5-dist.zip version on to pdf.js folder within the pdfJsViewer folder, but it didn’t help. I don’t know more. If you can diplay the file, please can you inform me.
Regards,

Screen Shot 2021-01-04 at 22.10.28

Screen Shot 2021-01-04 at 22.13.36

Screen Shot 2021-01-04 at 22.14.32

@drugurkocak,

Unfortunately, I don’t have iOS to test the bug with. Can you double-check if the javascript that you have added was applied to the page and that didn’t helped? Usually, it’s necessary to clear the browser’s cache.

Thanks @Vitaliy

I deleted ojs cache files, refreshed the mobile Safari but …
Should I have cleared the mobile Safari cache? I forgot about it. I will retry and write here if I can success.
Regards,

Hi,

I decided to go on the issue. I updated the server nodejs version to v14.15.4, npm to 6.14.10. Even I installed OJS 3.2.1-2 using stable-3_2_1 branch of Github repository (to a test domain), but nothing changed.

Upon this, I deleted PDFjsviewer folder of current installation, and copied the PDFjsviewer plugin files from backup of previous installation (3.2.1.1). Everything was back to normal. I have no idea about the reason for this :slight_smile:

I am sharing it here to be useful when someone else has the same problem.
Regards,