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
URL.revokeObjectURL(objectURL)
Parameters
objectURL- A
DOMStringrepresenting a object URL that was previously created by callingcreateObjectURL().
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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
revokeObjectURL | Chrome Full support 19 | Edge Full support 12 | Firefox
Full support
19
| IE Full support 10 | Opera Full support 15 | Safari Full support 6 | WebView Android Full support ≤37 | Chrome Android Full support 25 | Firefox Android
Full support
19
| Opera Android Full support 14 | Safari iOS Full support 6 | Samsung Internet Android Full support 1.5 |
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.
