URL: createObjectURL() static method
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Note: This feature is available inWeb Workers, except forService Workers.
ThecreateObjectURL() static method of theURL interfacecreates a string containing ablob URL pointing to the object given in the parameter.
For more information, seeblob URLs.
To release an object URL, callrevokeObjectURL().
Note:This feature isnot available inService Workers due to itspotential to create memory leaks.
In this article
Syntax
js
URL.createObjectURL(object)Parameters
objectA
Blob(such as aFile) orMediaSourceobject tocreate an object URL for.
Return value
A string containing an object URL that can be used to reference thecontents of the specified sourceobject.
Examples
Specifications
| Specification |
|---|
| File API> # dfn-createObjectURL> |