GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

StorageAccessHandle: SharedWorker() method

Storage Access API

Storage Access API

> [!NOTE]
> See SharedWorker() to understand usage.

## Syntax

```js-nolint
SharedWorker(url)
SharedWorker(url, name)
SharedWorker(url, options)
```

### Parameters

- `url`
- : See SharedWorker().
- `name`
- : See SharedWorker().
- `options`
- : See SharedWorker().

> [!NOTE]
> `options.sameSiteCookies` only supports the value "none", which is the default.

### Return value

An unpartitioned SharedWorker object.

### Exceptions

- `SecurityError` DomException
- : Thrown if access was not granted.

See SharedWorker()

## Examples

```js
document.requestStorageAccess({ SharedWorker: true }).then(
(handle) => {
console.log("SharedWorker access granted");
handle.SharedWorker(shared_worker_url);
},
() => {
console.log("SharedWorker access denied");
},
);
```

> [!NOTE]
> See [Using the Storage Access API](/docs/Web/API/Storage_Access_API/Using) for a more complete example.

## Specifications

## Browser compatibility

## See also

- Document.requestStorageAccess()
- [Using the Storage Access API](/docs/Web/API/Storage_Access_API/Using)

source: MDN Web Docs mirror · page

Cite this

"StorageAccessHandle: SharedWorker() method". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/StorageAccessHandle/SharedWorker

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·