Fixed non-working save button on Firefox 21 (issue #49(

This commit is contained in:
josdejong 2013-05-27 20:43:08 +02:00
parent 227f8dfcc0
commit 915497e9e0
1 changed files with 6 additions and 0 deletions

View File

@ -526,9 +526,15 @@ FileRetriever.prototype.saveFile = function (data, callback) {
var a = document.createElement('a');
if (this.options.html5 && a.download != undefined) {
// save file directly using a data URL
a.style.display = 'none';
a.href = 'data:application/json;charset=utf-8,' + encodeURIComponent(data);
a.download = this.getFilename();
// attach the element to the DOM, invoke a click action, and remove it again
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
callbackOnce();
}
else {