JavaScript: how to force file download
Forcing a file to be downloaded using JavaScript is a common technique used when you want to give users the ability to download files directly from a web application, without opening the file in the browser or relying on other external features.