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

undefined.

Example

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 AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Experimental
Chrome Full support 8Edge Full support 12Firefox Full support 4
Notes
Full support 4
Notes
Notes revokeObjectURL() is no longer available within the context of a ServiceWorker.
IE Full support 10Opera Full support 15Safari Full support 6WebView Android ? Chrome Android Full support 18Edge Mobile ? Firefox Android Full support 4
Notes
Full support 4
Notes
Notes revokeObjectURL() is no longer available within the context of a ServiceWorker.
Opera Android Full support 15Safari iOS Full support 6Samsung Internet Android ?

Legend

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

See also

Document Tags and Contributors

Last updated by: Sheppy,