Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS webview APP error: Unexpected server response (206) while retrieving PDF... #7815

Closed
godwin668 opened this issue Nov 15, 2016 · 6 comments

Comments

@godwin668
Copy link

godwin668 commented Nov 15, 2016

Link to PDF file (or attach file here):
https://mozilla.github.io/pdf.js/web/viewer.html

Configuration:

  • Web browser and its version:微信WeChat 6.3.27
  • Operating system and its version:IOS 10.0.3
  • PDF.js version:1.6.319

Steps to reproduce the problem:

  1. Open 微信WeChat
  2. view: https://mozilla.github.io/pdf.js/web/viewer.html

What went wrong? (add screenshot)

pdfjs

@yurydelendik
Copy link
Contributor

yurydelendik commented Nov 15, 2016

Looks like WeChat (the browser we don't support) has no "Safari" in it's user agent string (?). I cannot find any specific documentation on what user agent string shall be, probably something along "MicroMessenger/6.3.27" lines. We don't know market share of WeChat + PDF.js + iOS users, so I don't think we shall rush into adding that to the compatibility.js.

@godwin668
Copy link
Author

Until March, 2016, there are 0.927 billion active WeChat users in China. So it is very important to solve this PDF.js bug on WeChat. @yurydelendik

@yurydelendik
Copy link
Contributor

0.927 billion active WeChat users in China

  • how many of them use PDF.js?
  • how many of them use iOS 10?

@yurydelendik
Copy link
Contributor

So it is very important to solve this PDF.js bug on WeChat.

@godwin668 we gave it a try with #7800, but it did not work for you. Can you help us with proposing a solution?

@godwin668
Copy link
Author

@yurydelendik I do NOT know exact number but I do know two professional online preview provider is using PDF.js in China.

I'm NOT specialty in PDF.js, but I will try.

godwin668 added a commit to godwin668/pdf.js that referenced this issue Nov 16, 2016
@godwin668
Copy link
Author

@yurydelendik I tried and succeeded.

godwin668 added a commit to godwin668/pdf.js that referenced this issue Nov 17, 2016
Better way but NOT necessarily best way to solve the IOS webview APP error: Unexpected server response (206) while retrieving PDF...

Details:
1. At the beginning, I only found the Error in IOS WeChat APP, so I solved it by checking WeChat:
9ad57d4

2. But I found this error in other IOS app, so I checked UA details of them as follow:

a) iPhone WeChat APP UserAgent (Fail):
Mozilla/5.0 (iPhone; CPU iPhone OS 10_1_1 like Mac OS X) AppleWebKit/602.2.14 (KHTML, like Gecko) Mobile/14B100 MicroMessenger/6.3.30 NetType/WIFI Language/zh_CN

b) iPhone Other APP UserAgent (Fail):
Mozilla/5.0 (iPhone; CPU iPhone OS 10_1_1 like Mac X) AppleWebKit/602.2.14 (KHTML, like Gecko) Mobile/14B100 QYZone

Maybe all webview app in IOS 10 have this problem, and since Safari & Chrome in IOS also does NOT support range request in IOS, so I think it's a better way to disable range request in iPhone by this regex:
var isIPhone = /iPhone/.test(navigator.userAgent);
if (isIPhone) {
    PDFJS.disableRange = true;
    PDFJS.disableStream = true;
}

solve issues:
mozilla#7815
mozilla#7754
mozilla#7800
timvandermeij added a commit to timvandermeij/pdf.js that referenced this issue Nov 22, 2016
movsb pushed a commit to movsb/pdf.js that referenced this issue Jul 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants