# URL: createObjectURL() static method

 

The **`createObjectURL()`** static method of the [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) interface
creates a string containing a [blob URL](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/blob) pointing to the object given in the parameter.

For more information, see [blob URLs](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/blob).

To release an object URL, call [revokeObjectURL()](https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL_static).

> **NOTE:**
> This feature is _not_ available in [Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) due to its
> potential to create memory leaks.

## Syntax

```js-nolint
URL.createObjectURL(object)
```

### Parameters

- `object`
  - : A [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob) (such as a [File](https://developer.mozilla.org/en-US/docs/Web/API/File)) or [MediaSource](https://developer.mozilla.org/en-US/docs/Web/API/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](https://developer.mozilla.org/en-US/docs/Web/API/File_API/Using_files_from_web_applications#example_using_object_urls_to_display_images).

## Specifications

## Browser compatibility

## See also

- [Blob URLs](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/blob)
- [Using files from web applications](https://developer.mozilla.org/en-US/docs/Web/API/File_API/Using_files_from_web_applications)
- [Using object URLs to display images](https://developer.mozilla.org/en-US/docs/Web/API/File_API/Using_files_from_web_applications#example_using_object_urls_to_display_images)
- [URL.revokeObjectURL()](https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL_static)
- [HTMLMediaElement.srcObject](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/srcObject)
- [FileReader.readAsDataURL()](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL)
