We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

Summary

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

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support

81

Yes

1241015

7

61

FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support ? ? ? ? ? ? ?

1. Supported as webkitURL.

See also

Document Tags and Contributors

Last updated by: fscholz,