question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable range requests in Safari (both OSX and IOS)

See original GitHub issue

Attach (recommended) or Link to PDF file here: https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf

Configuration:

  • Web browser and its version: Safari 11.1 (OSX), Safari 11.0 (IOS)
  • Operating system and its version: OSX 10.13.4, IOS 11.4
  • PDF.js version: latest from master
  • Is a browser extension: no

Steps to reproduce the problem:

  1. Start dev server with gulp server
  2. Visit http://localhost:8888/web/viewer.html
  3. Observe network tab for 206 requests

What is the expected behavior? (add screenshot) The document is loaded using range requests

What went wrong? (add screenshot) The document is loaded with a single request. It looks like range requests were explicitly disabled by this code here:

  // Support: Safari 6.0+, iOS
  (function checkRangeRequests() {
    // Safari has issues with cached range requests, see issue #3260.
    // Last tested with version 6.0.4.
    if (isSafari || isIOS) {
      compatibilityParams.disableRange = true;
      compatibilityParams.disableStream = true;
    }
  })(); 

It feels a bit outdated. I’ve just tested pdfjs without this code in the specified browsers and it worked just fine. Is there a reason for keeping this code?

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension):

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
timvandermeijcommented, Jun 20, 2018

@fooware Thank you for looking into this. Given that range requests work again since Safari 9, I think we can remove the compatibility check because Safari 9 is the minimum version we support.

@yurydelendik @Snuffleupagus I have updated https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#which-browsers-are-supported to reflect that we only support iOS 10 and higher for Safari, as decided above. When I made the overview there, I looked through the commits we did for version 2.0 and found a commit where polyfills were removed that stated that Safari 8+ was now the minimum, but I can’t find it quickly anymore. However, since Safari 8 is almost three years old, I think we can safely drop explicity support for it, so I updated the page to reflect this too. I think it’s a fair support we have now.

If someone wants to create a patch to remove the compatibility code, please also bump https://github.com/mozilla/pdf.js/blob/620da6f4df6eb883ff89580b643ef0516035e0d0/gulpfile.js#L81 to >= 9.

1reaction
timvandermeijcommented, Jun 18, 2018

Not really, and we would like to limit it where possible. Could you indicate from which Safari/iOS versions range request work again, since it was apparently broken before?

Read more comments on GitHub >

github_iconTop Results From Across the Web

byte-range requests - Apple Support Communities
'Byre range requests' are the method used by iPhones to stream podcasts, consisting of requesting sections of the file at a time rather...
Read more >
Streaming video in Safari: Why is it so difficult? - LogRocket Blog
Figure 4: For video streaming to work in Safari, we must support HTTP range requests that can retrieve a portion of the video...
Read more >
Does iPhone/iPad Safari require 'Accept-Ranges' header for ...
According to the HTTP RFC, the Accept-Ranges header is optional even when byte-range requests are supported. However, the documented curl check implies that...
Read more >
Partial Content support for Range: Requests - gitlab-pages
I can confirm that Safari on both macOS and iOS currently can't play any video/audio media whatsoever from GitLab Pages because of this...
Read more >
WebKit Features in Safari 16.0
Safari 16 includes even more for Safari Web Extensions, including the ability to sync which extensions are enabled across iOS, iPadOS, and macOS ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found