const url = 'http://......'
fetch(url).then(res => {
res.blob().then(blob => {
var a = document.createElement('a');
var url = window.URL.createObjectURL(blob);
var filename = '....png';
a.href = url;
a.download = filename;
a.click();
window.URL.revokeObjectURL(url);
})
})
import FileSaver from 'file-saver';
const url = 'http://......'
const oReq = new XMLHttpRequest();
oReq.open("GET",url,true);
oReq.responseType = "blob";
oReq.onload = () => {
var file = new Blob([oReq.response]),{
type:"application/pdf"
})
FileSaver.saveAs(file,'.....pdf')
}
oReq.send()
const url = 'http://......'
const a = document.createElement('a');
a.target = "_blank";
a.download = "111.doc";
document.body.appendChild(a);
a.click()