From 679df53c2a7163324cde2e55752f243bf36e1d65 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Tue, 31 Jul 2018 00:50:49 +0530 Subject: [PATCH] Download files using app approach. Fixes #313. This is done till chrome.downloads works again. --- src/takeScreenshot.js | 4 ++++ src/utils.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/takeScreenshot.js b/src/takeScreenshot.js index 8e80a9a..6abbd64 100644 --- a/src/takeScreenshot.js +++ b/src/takeScreenshot.js @@ -44,6 +44,10 @@ function saveScreenshot(dataURI) { '/temporary/' + fileName; + // HACK: because chrome.downloads isn't working on optional permissions + // anymore. + return window.open(filePath); + chrome.downloads.download( { url: filePath diff --git a/src/utils.js b/src/utils.js index 699ce29..e5fc6d6 100644 --- a/src/utils.js +++ b/src/utils.js @@ -212,7 +212,7 @@ export function downloadFile(fileName, blob) { a.click(); a.remove(); } - if (window.IS_EXTENSION) { + if (false && window.IS_EXTENSION) { chrome.downloads.download( { url: window.URL.createObjectURL(blob),