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.

Note: This feature is available in Web Workers.

Note: This method is not available from service workers, due to issues with the Blob interface's life cycle and the potential for leaks.

Syntax

window.URL.revokeObjectURL(objectURL);

Parameters

objectURL
A DOMString representing a object URL that was previously created by calling createObjectURL().

Return value

Void.

Examples

See Using object URLs to display images.

Specification

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

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
revokeObjectURL
Experimental
Chrome Full support 8Edge Full support 12Firefox Full support 19
Notes
Full support 19
Notes
Notes revokeObjectURL() is no longer available within the context of a ServiceWorker.
IE Full support 10Opera Full support 15Safari Full support 6WebView Android Full support YesChrome Android Full support 18Firefox Android Full support 19
Notes
Full support 19
Notes
Notes revokeObjectURL() is no longer available within the context of a ServiceWorker.
Opera Android Full support 14Safari iOS Full support 6Samsung Internet Android Full support Yes

Legend

Full support  
Full support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
See implementation notes.
See implementation notes.

See also