Enable range requests in Safari (both OSX and IOS)
See original GitHub issueAttach (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:
- Start dev server with gulp server
- Visit http://localhost:8888/web/viewer.html
- 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:
- Created 5 years ago
- Comments:11 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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
.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?