Skip to content

Commit 0d4ddb6

Browse files
author
Antelle
committed
removed encodeURI and fixed Safari detection
1 parent a3dc9eb commit 0d4ddb6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

FileSaver.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ var saveAs = saveAs || (function(view) {
9494
}
9595
// on any filesys errors revert to saving with object URLs
9696
, fs_error = function() {
97-
if (target_view && typeof safari !== "undefined" && typeof FileReader !== "undefined") {
97+
if (target_view && /Version\/[\d\.]+.*Safari/.test(navigator.userAgent) && typeof FileReader !== "undefined") {
9898
// Safari doesn't allow downloading of blob urls
9999
var reader = new FileReader();
100100
reader.onloadend = function() {
101101
var base64Data = reader.result;
102102
base64Data = base64Data.replace(/^data:.*?;/, 'data:attachment/file;');
103-
target_view.location.href = encodeURI(base64Data);
103+
target_view.location.href = base64Data;
104104
filesaver.readyState = filesaver.DONE;
105105
dispatch_all();
106106
};

0 commit comments

Comments
 (0)