rndme/download

Chrome don't support download attribute in anchor tag

Closed this issue · 2 comments

Chrome don't support download attribute in anchor tag when yo click this link chrome force to download file and in my case need that open file and don't work if remove download attribute work fine.

function saver(url, winMode) {
if ('download' in anchor) { //html5 A[download]
anchor.href = url;
anchor.setAttribute("download", fileName); //THIS LINE
anchor.className = "download-js-link";
anchor.innerHTML = "downloading...";
anchor.style.display = "none";
document.body.appendChild(anchor);
setTimeout(function () {
anchor.click();
document.body.removeChild(anchor);
if (winMode === true) {setTimeout(function () { self.URL.revokeObjectURL(anchor.href);}, 250);}
}, 66);
return true;
}

I have the same problem. Can you help?

rndme commented

This is probably a result of the Content-Disposition header sent by the href's URL response. You can (if using CORS/SO) fatch the response to a blob, the URL.createObjectURL(theBlob) to get a url w/o http behavior (specifically UA downloading).

I don't see how this relates to download.js though, so closing.