开发者

Javascript: Automatically create a popup that downloads a .zip File

开发者 https://www.devze.com 2023-02-28 16:27 出处:网络
I have a download page on my website, and no开发者_如何学编程w I want to automatically \'present\' my .zip file to a user when he gets on the page.

I have a download page on my website, and no开发者_如何学编程w I want to automatically 'present' my .zip file to a user when he gets on the page.

An example of what I mean: http://www.chip.de/downloads/c1_downloads_hs_getfile_v1_16103932.html?t=1303674103&v=3600&s=1027a44b945de67a0da2ed759678a800

(In Firefox, the site above will automatically open a save dialog for Firefox) = THis is exactly what I want!


You could try running this redirect when the page loads:

<script type="text/javascript>
$(document).ready(function() {
    window.location.href = 'http://www.mydownload.com/download.zip';
}
</script>

Note: This uses jQuery

0

精彩评论

暂无评论...
验证码 换一张
取 消