From 328b3752fce59215b5656e528b1dde0e6dc1065a Mon Sep 17 00:00:00 2001 From: j Date: Fri, 25 Dec 2015 19:17:47 +0530 Subject: [PATCH] fix exporting larger srts --- js/app.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/app.js b/js/app.js index dab03a7..73043d2 100644 --- a/js/app.js +++ b/js/app.js @@ -266,17 +266,19 @@ function saveTxt() { } function saveContent(content, type, path) { - var uriContent = 'data:'+type+';base64,' + btoa(content); - var pom = document.createElement('a'); - pom.setAttribute('href', content); - pom.setAttribute('download', path); + var blob = new Blob([content], {type: type}); + var url = window.URL.createObjectURL(blob); + var a = document.createElement('a'); + a.href = url; + a.download = path; if (document.createEvent) { var event = document.createEvent('MouseEvents'); event.initEvent('click', true, true); - pom.dispatchEvent(event); + a.dispatchEvent(event); } else { - pom.click(); + a.click(); } + window.URL.revokeObjectURL(url); } function stDialog(titleTxt, text) {