W3cubDocs

/DOM

URL.revokeObjectURL

The URL.revokeObjectURL() static method releases an existing object URL which was previously created by calling 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.

You can call revokeObjectURL() any time after sourceopen is handled. This is because createObjectURL() is merely a means of connecting a media element's src attribute with a MediaSource instance. Calling revokeObjectURL() leaves the underlying objects in place and allows the platform to handle garbage collection at an appropriate time.

Note: This feature is available in Web Workers.

Syntax

window.URL.revokeObjectURL(objectURL);
objectURL
is a DOMString representing the object URL that was created by calling URL.createObjectURL().

Example

See Using object URLs to display images.

Specification

Specification Status Comment
File API
The definition of 'URL' in that specification.
Working Draft Initial definition

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 8.0[1] (Yes) 4.0 (2.0) 10.0 15.0 6.0[1]
7.0
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes)[1] (Yes) 14.0 (14.0) (Yes) 15.0 6.0[1]
7.0

[1] Implemented with URL prefixed as webkitURL.

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL