URL: revokeObjectURL() static method
{{APIRef("File API")}}
{{AvailableInWorkers("window_and_worker_except_service")}}
The revokeObjectURL()
static method of the {{domxref("URL")}}
interface
releases an existing object URL which was previously created by calling
{{domxref("URL.createObjectURL_static", "URL.createObjectURL()")}}
.
Call this method when you’ve finished using an object URL to let the browser know not to keep the reference to the file any longer.
[!NOTE] This method is not available in Service Workers, due to issues with the
{{domxref("Blob")}}
interface’s life cycle and the potential for leaks.
Syntax
URL.revokeObjectURL(objectURL)
Parameters
objectURL
- : A string representing an object URL that was previously created by
calling
{{domxref("URL.createObjectURL_static", "createObjectURL()")}}
.
- : A string representing an object URL that was previously created by
calling
Return value
None ({{jsxref("undefined")}}
).
Examples
See Using object URLs to display images.
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- Using files from web applications
- Using object URLs to display images
{{domxref("URL.createObjectURL_static", "URL.createObjectURL()")}}