From 81819890057ad009932155a6101870437bd935fb Mon Sep 17 00:00:00 2001 From: cyanxxx <504512494@qq.com> Date: Sat, 25 Dec 2021 22:54:04 +0800 Subject: [PATCH] fix: the new popup not the download window --- src/FileSaver.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/FileSaver.js b/src/FileSaver.js index 5d204ae..84b87e9 100644 --- a/src/FileSaver.js +++ b/src/FileSaver.js @@ -31,12 +31,12 @@ function bom (blob, opts) { return blob } -function download (url, name, opts) { +function download (url, name, opts, popup) { var xhr = new XMLHttpRequest() xhr.open('GET', url) xhr.responseType = 'blob' xhr.onload = function () { - saveAs(xhr.response, name, opts) + saveAs(xhr.response, name, opts, popup) } xhr.onerror = function () { console.error('could not download file') @@ -136,7 +136,7 @@ var saveAs = _global.saveAs || ( popup.document.body.innerText = 'downloading...' } - if (typeof blob === 'string') return download(blob, name, opts) + if (typeof blob === 'string') return download(blob, name, opts, popup) var force = blob.type === 'application/octet-stream' var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari