110
rated 0 times
[
116]
[
6]
/ answers: 1 / hits: 34641
/ 13 Years ago, fri, may 20, 2011, 12:00:00
In a Google chrome extension I am working on, a file is downloaded from a server with an XMLHttpRequest
. This file contains some binary data which are stored in an ArrayBuffer
object. In order to provide the possibility to download this file I am using the createObjectURL
API.
function publish(data) {
if (!window.BlobBuilder && window.WebKitBlobBuilder) {
window.BlobBuilder = window.WebKitBlobBuilder;
}
var builder = new BlobBuilder();
builder.append(data);
var blob = builder.getBlob();
var url = window.webkitURL.createObjectURL(blob);
$(#output).append($(<a/>).attr({href: url}).append(Download));
}
It is working fine; except that the filename is an opaque UUID like 9a8f6a0f-dd0c-4715-85dc-7379db9ce142
. Is there any way to force this filename to something more user-friendly?
More From » html