“Unduh JavaScript” Kode Jawaban

unduh JS

function downloadURI(uri, name) 
{
    var link = document.createElement("a");
    // If you don't know the name or want to use
    // the webserver default set name = ''
    link.setAttribute('download', name);
    link.href = uri;
    document.body.appendChild(link);
    link.click();
    link.remove();
}
GhostGamer

File Unduh JavaScript

$('a#someID').attr({target: '_blank', 
                    href  : 'http://localhost/directory/file.pdf'});
JDog

Unduh JavaScript

<a onclick="this.href='data:text/html;charset=UTF-8,'+encodeURIComponent(document.documentElement.outerHTML)" href="#" download="page.html">Download</a>
Draco Flame

Jawaban yang mirip dengan “Unduh JavaScript”

Pertanyaan yang mirip dengan “Unduh JavaScript”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya