Skip to content

Commit 57437eb

Browse files
Abhishek Reddyalexcjohnson
Abhishek Reddy
authored andcommitted
Fix SVG download URL resolution for IE/Edge
1 parent a89d01a commit 57437eb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/snapshot/filesaver.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ var fileSaver = function(url, name) {
5353

5454
// IE 10+ (native saveAs)
5555
if(typeof navigator !== 'undefined' && navigator.msSaveBlob) {
56-
navigator.msSaveBlob(new Blob([url]), name);
56+
// At this point we are only dealing with a SVG encoded as
57+
// a data URL (since IE only supports SVG)
58+
var encoded = url.split(/^data:image\/svg\+xml,/)[1];
59+
var svg = decodeURIComponent(encoded);
60+
navigator.msSaveBlob(new Blob([svg]), name);
5761
resolve(name);
5862
}
5963

0 commit comments

Comments
 (0)