method creates a
DOMString containing a URL representing the object
given in the parameter.
To release an object URL, call
Note: This feature is available in Web Workers
Note: This feature is not available in Service Workers due to its potential to create memory leaks.
const objectURL = URL.createObjectURL(object)
DOMString containing an object URL that can be used to reference the
contents of the specified source
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
URL.revokeObjectURL() when you no longer need them.
Browsers will release object URLs 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.
In older versions of the Media Source specification, attaching a stream to a
<video> element required creating an object URL for the
MediaStream. This is no longer necessary, and browsers are removing
support for doing this.
|File API |
BCD tables only load in the browser