i trying build chrome extension download of anchor tags point .wav file given page. using filesaver.js. problem downloaded files contain no data , 'undefined'. code follows (urllist array contains urls end in .wav):
var xhrlist = []; urllist.foreach(function (url, index) { xhrlist[index] = new xmlhttprequest(); xhrlist[index].open('get',url,true); xhrlist[index].responsetype = 'blob'; xhrlist[index].onreadystatechange = function (e) { if (this.readystate == 4 && this.status == 200) { var blob = new blob([this.response], {type:'audio/wav'}); saveas(blob, url); } } xhrlist[index].send(); });
i've tried looking @ few solutions haven't had luck them. appreciated.
reloading extension did trick.
Comments
Post a Comment