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) {
var blobToSave = new Blob([textstr], {type:'text/plain'});
var blobURL = (window.webkitURL !== null) ?
window.webkitURL.createObjectURL(blobToSave) :
window.URL.createObjectURL(blobToSave);
DOM_target.append($('<a>',
{
var blobToSave = new Blob([textstr], {
type: 'text/plain'
});
var blobURL = "";
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',
href: blobURL,
css: {display: 'none'},
css: {
display: 'none'
},
download: filename,
html: 'download file'
}));