Downloading files from JavaScript with Data URLs
See also Reading files from JavaScript.
Just want to have an all-in-one working example here.
From The Project Gutenberg eBook of Metamorphosis (gutenberg.org):
One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked.
Here's the script:
(Script displayed with Galadriel's Mirror 2.)MDN, as always, has more info about the "data" URL scheme:
Did you know "data" URLs were first defined in 1998 in RFC 2397?
Back to javascript