[whatwg] Indicate a file name for data: URLs?

Boris Zbarsky bzbarsky at MIT.EDU
Mon Mar 21 05:49:05 PDT 2011


On 3/21/11 8:05 AM, Philip Jägenstedt wrote:
> On http://foolip.org/microdatajs/live/#json I have a "Download it!"
> function which uses data: URLs to save JSON generated by JavaScript. The
> only real limitation with this approach is that one cannot suggest a
> file name, so in Opera the suggested file name is "default".
>
> Are there other ways to save script-generated data that don't involve
> bouncing against a server? If not, any ideas how one might fix this with
> data: URLs? The Content-Disposition header solves this problem, but
> can't be applied here.

Going forward, there have been some proposals for making this work.  See 
thread at http://lists.w3.org/Archives/Public/uri/2010Feb/0058.html

For your particular use case, a "disposition" attribute on <a> or 
something would also work; I'm pretty sure that this has come up before 
as well.

-Boris



More information about the whatwg mailing list