I am trying to make a button force download a PDF, but I can’t figure out how, I am using an onclick function to count the number of times the button was clicked, but I want it to also force download the PDF here is my code:
<script type="text/javascript">
var clicks = 0;
function onClick() {
clicks += 1;
document.getElementById("clicks").innerHTML = clicks;
};
</script>
<button type="button" onClick="onClick()"> <b>Download Game</b> <p> <b>Downloads: <a id="clicks">0</a> </b> </p>
</button>
The file I want to download is called The_Game.zip, it currently has nothing in it because I’m trying to see if this is possible.