From 839813176c1fd982d2ce394170542f13528c5c89 Mon Sep 17 00:00:00 2001 From: Akhilesh Goutam Date: Thu, 15 Jul 2021 14:37:51 +0530 Subject: [PATCH] Included credentials while downloading file --- src/FileSaver.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/FileSaver.js b/src/FileSaver.js index 5d204ae..770f7c4 100644 --- a/src/FileSaver.js +++ b/src/FileSaver.js @@ -34,6 +34,7 @@ function bom (blob, opts) { function download (url, name, opts) { var xhr = new XMLHttpRequest() xhr.open('GET', url) + xhr.withCredentials = true; xhr.responseType = 'blob' xhr.onload = function () { saveAs(xhr.response, name, opts) @@ -48,6 +49,7 @@ function corsEnabled (url) { var xhr = new XMLHttpRequest() // use sync to avoid popup blocker xhr.open('HEAD', url, false) + xhr.withCredentials = true; try { xhr.send() } catch (e) {}