MDN self-hosted library · e01.org
Web / API / URL

URL: createObjectURL() static method

File API windowandworkerexceptservice

no runnable cells web-api-static-method upstream source

File API window_and_worker_except_service

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

See also