From edc85b56b005349c4049139f6a0f6daff7879004 Mon Sep 17 00:00:00 2001 From: Barry Tielkes Date: Tue, 30 Jun 2015 17:08:22 +0200 Subject: [PATCH] DownloadUrl injection, enabling separate view url and download url --- viewer.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/viewer.js b/viewer.js index 6f0e475..15daafc 100644 --- a/viewer.js +++ b/viewer.js @@ -348,9 +348,13 @@ function Viewer(viewerPlugin, parameters) { * @return {undefined} */ this.download = function () { - var documentUrl = url.split('#')[0]; - documentUrl += '#viewer.action=download'; - window.open(documentUrl, '_parent'); + if(url.indexOf('?downloadUrl=') !== -1) { + window.open(url.split('?downloadUrl=')[1], '_blank'); + } else { + var documentUrl = url.split('#')[0]; + documentUrl += '#viewer.action=download'; + window.open(documentUrl, '_parent'); + } }; /**