var a = document.createElement('a'); a.setAttribute('href', href); document.body.appendChild(a); a.click();