javascript - Error: access denied on anchor tag click - while trying to download file in AngularJS -
i have file content byte array returnedfrom api controller. when anchor tag clicked download content file in respective format doc/docx/pdf. i'm using ie11 - html5 download attribute not supported in ie11. please suggest me solution.
here code have used:
function(data, status) { if (data != null) { var blob = new blob([data.filecontent], { type: 'application/pdf' }); var downloadurl = (window.url || window.webkiturl).createobjecturl(blob); var = document.createelement('a'); a.href = downloadurl; //a.download = "content.txt" ie doesn't support download attribute a.target = "_blank"; document.body.appendchild(a); a.click(); // here throws error access denied document.body.removechild(a); } }
Comments
Post a Comment