W3cubDocs

/Web APIs

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

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

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet WebView Android WebView on iOS
createObjectURL_static 19 12
19createObjectURL() is no longer available within the context of a ServiceWorker.
15 6 25
19createObjectURL() is no longer available within the context of a ServiceWorker.
14 6 1.5 4.4 6

See also

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static