Auto Start Download File With Javascript


Full tutorial about how to make auto download files with jquery javascript code, And how to to start auto download files with Javascript.

Example Code

<html>
<head>
<title>Start Auto Download file</title>
<script src="http://code.jquery.com/jquery-3.2.1.min.js"></script>
<script>
$(function() {
$('a[data-auto-download]').each(function(){
var $this = $(this);
setTimeout(function() {
window.location = $this.attr('href');
}, 2000);
});
});
</script>
</head>
<body>
<div class="wrapper">
<p>The download should start shortly. If it doesn't, click
<a data-auto-download href="ajax-autocomplete-with-jquery.zip">here</a>.</p>
</div>
</body>
</html>

Copy the code and use it by yourself, hope this tutorial useful for you. thank you.