How to access and download a file from a server using HTML 5

HTML5 supports the download attribute: http://webreflection.blogspot.com/2011/08/html5-how-to-create-downloads-on-fly.html

Example:

<a href="http://.../bad-romance.mp3" download="Bad Romance.mp3">Save "Bad Romance" to your computer</a>

Clicking on this will allow the browser to handle the download (instead of opening the file using whatever application is associated with the mimetype), including a progress bar.

Note: You really want to be careful not to deviate from normal user expectation by trying to create your own implementation. This is synonymous with forcing a link to open in a new tab–it can be confusing to the user if they are expecting one behavior but receive another. In your case, try to specifically explain that this will be a “download” link, not a “play” link. The example above does this, but a “download” icon might also suffice.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)