
This file downloader is made with pure JavaScript no server-side language is used to create it. Remember, the file should be publicly accessible to download. Users have to paste a valid URL of the file and click the download button to download the file.

Documentation:ĭata URLs are composed of four parts: a prefix (data:), a MIME type indicating the type of data, an optional base64 token if non-textual, and the data itself. Download Videoīecause we use a Data URL, we are allowed to set the mimetype which indicates the type of data to download.

Just set the href attribute to "data:(mimetypeheader),(url)".

This can be solved 100% entirely with HTML alone. Initiate_user_download('data.csv', 'text/csv', 'Sample,Data,Here\n1,2,3\n') Here is a pure JavaScript solution I tested working in Firefox and Chrome but not in Internet Explorer: function downloadDataUrlFromJavascript(filename, dataUrl) )
