From e6dadaadb8137f4e157fbcf565dba0ff68de627e Mon Sep 17 00:00:00 2001 From: Brendan Dahl Date: Mon, 3 Jun 2013 15:31:42 -0700 Subject: [PATCH] Disable range request loading for safari. --- web/compatibility.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/web/compatibility.js b/web/compatibility.js index 0230dc5a2..76f248e77 100644 --- a/web/compatibility.js +++ b/web/compatibility.js @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* globals VBArray */ +/* globals VBArray, PDFJS */ 'use strict'; @@ -438,3 +438,20 @@ enumerable: true }); })(); + +(function checkRangeRequests() { + // Safari has issues with cached range requests see: + // https://github.com/mozilla/pdf.js/issues/3260 + // Last tested with version 6.0.4. + var isSafari = Object.prototype.toString.call( + window.HTMLElement).indexOf('Constructor') > 0; + if (!isSafari) { + return; + } + document.addEventListener('DOMContentLoaded', function (e) { + if (isSafari) { + console.warn('Range requests are disabled for safari.'); + PDFJS.disableRange = true; + } + }); +})();