From e583070deb73113f13e7a5244138582b7a86140a Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Wed, 10 Jul 2013 22:07:23 +0200 Subject: [PATCH] Download PDF from cache for IE10 / IE11 IE9 falls back to downloading from the original URL. --- web/viewer.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/web/viewer.js b/web/viewer.js index 645201e19..a21cde03a 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -1015,11 +1015,20 @@ var PDFView = { this.pdfDocument.getData().then( function getDataSuccess(data) { var blob = PDFJS.createBlob(data.buffer, 'application/pdf'); +//#if GENERIC + if (navigator.msSaveBlob) { + // IE10 / IE11 + if (!navigator.msSaveBlob(blob, getPDFFileNameFromURL(url))) { + noData(); + } + return; + } +//#endif var blobUrl = URL.createObjectURL(blob); triggerSaveAs(url, blobUrl); }, noData // Error occurred try downloading with just the url. - ); + ).then(null, noData); }, fallback: function pdfViewFallback() {