This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The requestStorageAccess() method of the Document interface returns a Promise that resolves if the access to first-party storage was granted, and rejects if access was denied.
Storage access is granted based on a series of checks described here:
allow-storage-access-by-user-activation, reject.Document.hasStorageAccess() and requestStorageAccess().See Storage Access API for more information.
Promise<boolean> requestStorageAccess()
None.
a Promise that resolves if the access to first-party storage was granted, and rejects if access was denied.
If the promise gets resolved, the resolve handler will run as if a user gesture was being processed, so it will be able to call APIs that require user activation.
document.requestStorageAccess().then(
() => { console.log('access granted') },
() => { console.log('access denied') }
); The API is currently only at the proposal stage — the standardization process has yet to begin. You can currently find specification details of the API at Apple's Introducing Storage Access API blog post, and WHATWG HTML issue 338 — Proposal: Storage Access API.
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | No | No | 65
|
No | No | 11.1
|
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | No | No | No | 65
|
No | 11.1
|
? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/document/requestStorageAccess