diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-06-04 14:02:52 +0300 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-06-04 14:34:17 +0300 |
commit | bfc39f2b6e84d7521d04cd69c8e309e1bd4301a6 (patch) | |
tree | a56e5d8de7bbdab2e66b90621f604a10c877c542 | |
parent | 5c6dde5d433023b9d6a3cefc5f2c79aafeb35c14 (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.js | 2 |
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); |