There was a scripting error on this page. While it is being addressed by site editors, you can view partial content below.
{{ ApiRef }}
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.
SummaryEdit
The URL.createObjectURL()
static method creates a DOMString
containing an URL representing the object given in parameter. The URL lifetime is tied to the document
in the window on which it was created. The new object URL represents the specified File
object or Blob
object.
SyntaxEdit
objectURL = URL.createObjectURL(blob);
ParametersEdit
- blob
ExampleEdit
See Using object URLs to display images.
NotesEdit
Each time you call createObjectURL()
, a new object URL is created, even if you've already created one for the same object. Each of these must be released by calling URL.revokeObjectURL()
when you no longer need them. Browsers will release these automatically when the document is unloaded; however, for optimal performance and memory usage, if there are safe times when you can explicitly unload them, you should do so.
SpecificationsEdit
Specification | Status | Comment |
---|---|---|
File API The definition of 'URL' in that specification. |
Working Draft | Initial definition. |
Browser compatibilityEdit
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 8 [1] 23 |
4.0 (2) | 10 | 15 | 6 [1] 7 |
In a Web Worker |
10 [1] 23 |
21 (21) | 11 | 15 | 6 [1] 7 |
[1] With URL
prefixed as webkitURL