tweaking saveAstext

This commit is contained in:
Josh de Leeuw 2013-11-09 19:49:25 -05:00
parent 61b4a07fa6
commit 68a7b64c66

View File

@ -294,15 +294,22 @@
} }
function saveTextToFile(textstr, filename) { function saveTextToFile(textstr, filename) {
var blobToSave = new Blob([textstr], {type:'text/plain'}); var blobToSave = new Blob([textstr], {
var blobURL = (window.webkitURL !== null) ? type: 'text/plain'
window.webkitURL.createObjectURL(blobToSave) : });
window.URL.createObjectURL(blobToSave); var blobURL = "";
DOM_target.append($('<a>', if (window.webkitURL !== null) {
{ blobURL = window.webkitURL.createObjectURL(blobToSave);
}
else {
blobURL = window.URL.createObjectURL(blobToSave);
}
DOM_target.append($('<a>', {
id: 'jspsych-download-as-text-link', id: 'jspsych-download-as-text-link',
href: blobURL, href: blobURL,
css: {display: 'none'}, css: {
display: 'none'
},
download: filename, download: filename,
html: 'download file' html: 'download file'
})); }));