removed encodeURI and fixed Safari detection

This commit is contained in:
Antelle
2015-10-03 23:19:11 +03:00
parent a3dc9ebddc
commit 0d4ddb673d
+2 -2
View File
@@ -94,13 +94,13 @@ var saveAs = saveAs || (function(view) {
}
// on any filesys errors revert to saving with object URLs
, fs_error = function() {
if (target_view && typeof safari !== "undefined" && typeof FileReader !== "undefined") {
if (target_view && /Version\/[\d\.]+.*Safari/.test(navigator.userAgent) && typeof FileReader !== "undefined") {
// Safari doesn't allow downloading of blob urls
var reader = new FileReader();
reader.onloadend = function() {
var base64Data = reader.result;
base64Data = base64Data.replace(/^data:.*?;/, 'data:attachment/file;');
target_view.location.href = encodeURI(base64Data);
target_view.location.href = base64Data;
filesaver.readyState = filesaver.DONE;
dispatch_all();
};