Is there any way to specify a suggested filename when using data: URI?

前端 未结 16 1866
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-22 03:09

If for example you follow the link:

data:application/octet-stream;base64,SGVsbG8=

The browser will prompt you to download a file consisting of t

16条回答
  •  庸人自扰
    2020-11-22 03:54

    There is a tiny workaround script on Google Code that worked for me:

    http://code.google.com/p/download-data-uri/

    It adds a form with the data in it, submits it and then removes the form again. Hacky, but it did the job for me. Requires jQuery.

    This thread showed up in Google before the Google Code page and I thought it might be helpful to have the link in here, too.

提交回复
热议问题