Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/files_pdfviewer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2020-06-04 14:02:52 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-06-04 14:34:05 +0300
commit540ca4db1857a1580d5cfc121314014ff9858eb3 (patch)
treef18131fbab0bc3025654b4dbe82844ae3547f109
parente877ebb10547a1ff59f39b15fcf4ab1eff18eb92 (diff)
Allow downloads in sandboxed iframe
Until now it was possible to initiate a download from an iframe, but the HTML spec has been updated to prevent that unless "allow-downloads" is set in the "sandbox" attribute of the iframe. As the PDF viewer shows the PDF file in an iframe the "allow-downloads" attribute is needed to be able to download the PDF file by clicking on the "Download" button of the UI in browsers that have implemented the spec change (like Chromium 83; other browsers are expected to follow). Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r--js/previewplugin.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/js/previewplugin.js b/js/previewplugin.js
index 67835fe..dec4712 100644
--- a/js/previewplugin.js
+++ b/js/previewplugin.js
@@ -54,7 +54,7 @@ var isSecureViewerAvailable = function () {
var shown = true;
var $iframe;
var viewer = OC.generateUrl('/apps/files_pdfviewer/?file={file}', {file: downloadUrl});
- $iframe = $('<iframe id="pdframe" style="width:100%;height:100%;display:block;position:absolute;top:0;z-index:1041;left:0;" src="'+viewer+param+'" sandbox="allow-scripts allow-same-origin allow-popups allow-modals allow-top-navigation" allowfullscreen="true"/>');
+ $iframe = $('<iframe id="pdframe" style="width:100%;height:100%;display:block;position:absolute;top:0;z-index:1041;left:0;" src="'+viewer+param+'" sandbox="allow-scripts allow-same-origin allow-popups allow-modals allow-top-navigation allow-downloads" allowfullscreen="true"/>');
if(isFileList === true) {
FileList.setViewerMode(true);