NEW WAY TO DOWNLOAD A FILE USING AN ARBITRARY NAME: THE DOWNLOADATTRIBUTE
HTML5 proposes using a new attribute named download to download resources rather than navigating to them. The example below shows how to trigger the download of an image by the browser (instead of rendering it, which is the default behavior) with a name different from the name of the resource.
- <a href="/asset-v1:W3Cx+W3C-HTML5+2015T3+type@asset+block/normal.gif" download="MichelBuffa.gif">
- download a picture of Michel Buffa
- </a>
WARNING: since 2015, and for security reasons, the image should be located on the same domain as the HTML page that contains the link (use a relative URL works well, for example, but linking a page on another domain will not work, it willkeep its original name).