Re: [FileAPI] Questions on using Blobs for img src and a href

On Thu, Oct 3, 2013 at 5:35 PM, Brian Matthews (brmatthe) <brmatthe@cisco.com<mailto:brmatthe@cisco.com>> wrote:
I've been doing some prototyping around displaying images with <img src="blob:..."> and providing links to content using <a href="blob:...">. I've got it working, and it's all very cool, but there are a couple of things that seem like they could work better. They might be things that are too user agent specific for the spec (http://www.w3.org/TR/FileAPI/) to comment on, but I thought I'd ask here and see if there's something I'm missing, and make a suggestion.

(FYI, the link you want is http://dev.w3.org/2006/webapi/FileAPI/.  Click the "Editor's Draft" link at the top of the spec.  This "TR" link happens to be recent, but they're often very out of date.)

I looked at all 3 and they're the same in this case, so I just used the shortest link, and the one that comes up first when you search w3.org. If the Editor's Drafts are the newest, I'll look at and reference those in the future.

Note that from the spec one would think I could do a new File(myBlob, myFilename), but both Firefox and Chrome throw exceptions when I do that (is that expected?), and if I use a "real" File (from a FileList), the name doesn't flow through to the blob URL and isn't used when saving.

The File ctor is probably not implemented in browsers yet.  They definitely should use the File's filename as the save-as hint, which may also not yet be implemented.  You can file bugs on those browsers if you think it'll help.

It's implemented somewhat, although maybe it's just a stub that throws an exception. I'll come up with a test case and write bugs on at least Firefox and Chrome. That will only get me part way there though, as they don't seem to use the name even when it's there, but maybe that's another set of bugs..

Thanks,
Brian

Received on Friday, 4 October 2013 23:44:01 UTC