Users fill out a form. With a valid form, they click to download a file. I would like to be able to redirect them to another page (e.g., page2.html) AND initiate a download.
I can’t initiate download on page2.html because most browsers will flag security warnings if a download link isn’t directly clicked on.
How is something like this accomplished using javascript or jquery? Obviously the following doesn’t work but it’s meant for illustrative purposes:
document.getElementById("foo").onclick = function(){
window.location = "/download.exe";
window.location = "/page2.html";
}
You could use a link to the file and
onclickto trigger “go to the next page shortly”.