Force a browser to save file as after clicking link [duplicate]

You could use the HTML5 download attribute like so:

<a href="https://stackoverflow.com/questions/11353425/path/to/file" download>Click here to download</a>

This opens a “save as” dialog regardless of file type without taking you away from the page.

Leave a Comment