Demo Generate & Download a File Use JavaScript

Jumat, 23 November 2012 »

A demo of the HTML5 download attribute. When used on an anchor, this attribute signifies that the resource it points to should be downloaded by the browser rather than navigating to it.

'Create file' creates a .txt file from the contenteditable region's content. This is done by using window.URL.createObjectURL(). That generated file can be named and saved to the user's machine by setting the download attribute on a link.

Browser support: right now, only Chrome dev channel (14.0.835.15+) supports this attribute.

Beben Koben si Bloglang anu Ganteng Kalem tea \m/

Cxtir sonis li kak, on mne maks zvestis profesor. Gda polakju blagodarim vo. Troh zxiznuf mai te. Kupit pervju jazikas na sos, kak iz edat podpor. Pisajut hrvatzem dev mi, jazika partner rodzinuf zxe ne, razumju belaruszem des bu. Uzx zavod tomatis televidenie do.

This link was created using ablob: URL (huh? ). It contains the download attribute, which means clicking it will force the browser to download the resource rather than navigating to it.

In Chrome, you can also drag this link out of the browser tab and the file will be saved. (huh? )


No comments yet