From 729e35079f164c2e58448fba46fa0a974cd1848e Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Wed, 12 Jun 2013 12:03:27 -0500 Subject: [PATCH] Disables range requestes for safari immediately --- web/compatibility.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/web/compatibility.js b/web/compatibility.js index b15709c00..99534efb3 100644 --- a/web/compatibility.js +++ b/web/compatibility.js @@ -18,6 +18,12 @@ 'use strict'; +// Initializing PDFJS global object here, it case if we need to change/disable +// some PDF.js features, e.g. range requests +if (typeof PDFJS === 'undefined') { + (typeof window !== 'undefined' ? window : this).PDFJS = {}; +} + // Checking if the typed arrays are supported (function checkTypedArrayCompatibility() { if (typeof Uint8Array !== 'undefined') { @@ -445,11 +451,7 @@ // 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) { - console.warn('Range requests are disabled for safari.'); + if (isSafari) { PDFJS.disableRange = true; - }, true); + } })();