Skip to content

Instantly share code, notes, and snippets.

@ggoodman
Created July 23, 2011 20:17
Show Gist options
  • Save ggoodman/1101836 to your computer and use it in GitHub Desktop.
Save ggoodman/1101836 to your computer and use it in GitHub Desktop.
buildSaveURL
buildSaveURL = function(content, mime) {
// Better feature detection would be needed for portability
urlBuilderBase = window.createObjectURL ? window : window.webkitURL;
// Create and fill the blob
bb = new BlobBuilder();
bb.append(content);
// Create and return the blog url
return urlBuilderBase.createObjectURL(bb.getBlob(mime));
};
@eligrey
Copy link

eligrey commented Jul 24, 2011

urlBuilderBase can also be URL, and BlobBuilder can also be WebKitBlobBuilder or MozBlobBuilder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment