Disables range requestes for safari immediately

This commit is contained in:
Yury Delendik 2013-06-12 12:03:27 -05:00
parent ee1a4cd449
commit 729e35079f

View File

@ -18,6 +18,12 @@
'use strict'; '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 // Checking if the typed arrays are supported
(function checkTypedArrayCompatibility() { (function checkTypedArrayCompatibility() {
if (typeof Uint8Array !== 'undefined') { if (typeof Uint8Array !== 'undefined') {
@ -445,11 +451,7 @@
// Last tested with version 6.0.4. // Last tested with version 6.0.4.
var isSafari = Object.prototype.toString.call( var isSafari = Object.prototype.toString.call(
window.HTMLElement).indexOf('Constructor') > 0; window.HTMLElement).indexOf('Constructor') > 0;
if (!isSafari) { if (isSafari) {
return;
}
document.addEventListener('DOMContentLoaded', function (e) {
console.warn('Range requests are disabled for safari.');
PDFJS.disableRange = true; PDFJS.disableRange = true;
}, true); }
})(); })();