URL: createObjectURL() static method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Note: This feature is available in Web Workers, except for Service Workers.

The createObjectURL() static method of the URL interface creates a string containing a blob URL pointing to the object given in the parameter.

For more information, see blob URLs.

To release an object URL, call revokeObjectURL().

Note: This feature is not available in Service Workers due to its potential to create memory leaks.

Syntax

js
URL.createObjectURL(object)

Parameters

object

A Blob (such as a File) or MediaSource object to create an object URL for.

Return value

A string containing an object URL that can be used to reference the contents of the specified source object.

Examples

See Using object URLs to display images.

Specifications

Specification
File API
# dfn-createObjectURL

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Bun
Deno
Node.js
createObjectURL() static method
Chrome – Full support
Chrome 19 (Release date: 2012-05-15)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 19 (Release date: 2013-02-19)
footnote
footnote createObjectURL() is no longer available within the context of a ServiceWorker.
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 6 (Release date: 2012-07-25)
footnote Full support
Chrome Android – Full support
Chrome Android 25 (Release date: 2013-02-27)
footnote Full support
Firefox for Android – Full support
Firefox for Android 19 (Release date: 2013-02-19)
footnote
footnote createObjectURL() is no longer available within the context of a ServiceWorker.
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 6 (Release date: 2012-09-10)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1.5 (Release date: 2013-09-25)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 6 (Release date: 2012-09-10)
footnote Full support
Bun – Full support
Bun 1 (Release date: 2023-09-08)
footnote Full support
Deno – Full support
Deno 1.9 (Release date: 2021-04-13)
footnote Full support
Node.js – Full support
Node.js 16.7 (Release date: 2021-08-17)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
See implementation notes.

See also