diff --git a/src/js/service/storage/FileDownloadStorageService.js b/src/js/service/storage/FileDownloadStorageService.js index 5eb26ded..9ef2f15e 100644 --- a/src/js/service/storage/FileDownloadStorageService.js +++ b/src/js/service/storage/FileDownloadStorageService.js @@ -13,7 +13,7 @@ var fileName = piskelName + '-' + timestamp + '.piskel'; try { - pskl.utils.FileUtils.downloadAsFile(new Blob([serialized]), fileName); + pskl.utils.FileUtils.downloadAsFile(new Blob([serialized], {type : 'application/piskel+json'}), fileName); deferred.resolve(); } catch (e) { deferred.reject(e.message); diff --git a/src/js/utils/FileUtils.js b/src/js/utils/FileUtils.js index 1bbbf19a..ff22335c 100644 --- a/src/js/utils/FileUtils.js +++ b/src/js/utils/FileUtils.js @@ -8,9 +8,9 @@ ns.FileUtils = { readFile : function (file, callback) { var reader = new FileReader(); - reader.onload = function (event) { - callback(event.target.result); - }; + reader.addEventListener('loadend', function() { + callback(reader.result); + }); reader.readAsDataURL(file); },