W3C home > Mailing lists > Public > uri@w3.org > February 2010

data URIs - filename and content-disposition

From: Michael A. Puls II <shadow2531@gmail.com>
Date: Wed, 24 Feb 2010 02:04:32 -0500
To: uri@w3.org
Message-ID: <op.u8mdxtsx1ejg13@sandra-svwliu01>
I have a web page that's meant to run locally via file:. It uses XHR to  
load a vcard file. I then scan the file and convert it to a different text  
file format.

I want to provide a save link for the new file format, so I decided to use  
a data URI. But, I want clicking on the data URI link to show an open/save  
dialog.

I was able to do this by using <a  
href="data:application/octetstream;charset=utf-8,file_data"  
target="_blank">Save</a>.

However, there are 2 problems.

1. There doesn't seem to be a way to give a filename hint.

2. I'd rather not use the octetstream mime type just to trigger a save  
dialog.

With that said, I think it'd be awesome if you could do something like:

<a  
href="data:text/plain;charset=utf-8;filename=tada.txt;content-disposition=attachment,file_data">Save</a>.

Setting aside the File API work, what about specifying those two in an  
update to the data URI RFC? Any vendors against implementing support for  
it?

-- 
Michael
Received on Wednesday, 24 February 2010 07:05:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 13 January 2011 12:15:45 GMT