diff --git a/web/compatibility.js b/web/compatibility.js index 2b4fe85f4..4bed22d79 100644 --- a/web/compatibility.js +++ b/web/compatibility.js @@ -26,6 +26,7 @@ var isAndroidPre3 = /Android\s[0-2][^\d]/.test(userAgent); var isAndroidPre5 = /Android\s[0-4][^\d]/.test(userAgent); var isChrome = userAgent.indexOf('Chrom') >= 0; var isChromeWithRangeBug = /Chrome\/(39|40)\./.test(userAgent); +var isIOSChrome = userAgent.indexOf('CriOS') >= 0; var isIE = userAgent.indexOf('Trident') >= 0; var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent); var isOpera = userAgent.indexOf('Opera') >= 0; @@ -456,10 +457,11 @@ if (typeof PDFJS === 'undefined') { })(); // Checks if possible to use URL.createObjectURL() -// Support: IE +// Support: IE, Chrome on iOS (function checkOnBlobSupport() { - // sometimes IE loosing the data created with createObjectURL(), see #3977 - if (isIE) { + // sometimes IE and Chrome on iOS loosing the data created with + // createObjectURL(), see #3977 and #8081 + if (isIE || isIOSChrome) { PDFJS.disableCreateObjectURL = true; } })(); diff --git a/web/download_manager.js b/web/download_manager.js index 674dfb622..0be8a011b 100644 --- a/web/download_manager.js +++ b/web/download_manager.js @@ -86,12 +86,6 @@ if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC || CHROME')) { }, download: function DownloadManager_download(blob, url, filename) { - if (!URL) { - // URL.createObjectURL is not supported - this.downloadUrl(url, filename); - return; - } - if (navigator.msSaveBlob) { // IE10 / IE11 if (!navigator.msSaveBlob(blob, filename)) { @@ -100,6 +94,12 @@ if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC || CHROME')) { return; } + if (pdfjsLib.PDFJS.disableCreateObjectURL) { + // URL.createObjectURL is not supported + this.downloadUrl(url, filename); + return; + } + var blobUrl = URL.createObjectURL(blob); download(blobUrl, filename); }