From 2678f315b48e43c723c4969a29a4ebfc6ea2324b Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Thu, 21 Dec 2023 11:04:52 +0000 Subject: [PATCH] Attempt to fix PDF downloading in NWJS --- www/js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/js/app.js b/www/js/app.js index 0294d457..758a7aaa 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -5146,7 +5146,7 @@ function handleClickOnReplayLink (ev, anchor) { // Due to the iframe sandbox, we have to prevent the PDF viewer from opening in the iframe and instead open it in a new tab // Note that some Replay PDFs have html mimetypes, or can be redirects to PDFs, we need to check the URL as well if (/pdf/i.test(mimetype) || /\.pdf(?:[#?]|$)/i.test(anchor.href) || /\.pdf(?:[#?]|$)/i.test(dirEntry.url)) { - if (/Android/.test(params.appType)) { + if (/Android/.test(params.appType) || window.nw) { // User is on an Android device, where opening a PDF in a new tab is not sufficient to evade the sandbox // so we need to download the PDF instead var readAndDownloadBinaryContent = function (zimUrl) {