fall back to non-standard persisted api for Safari

This commit is contained in:
Bruno Windels 2020-03-25 12:04:09 +01:00
parent 26bda5933b
commit f6e9c32c48
2 changed files with 11 additions and 0 deletions

View file

@ -48,6 +48,11 @@ export function tryPersistStorage() {
navigator.storage.persist().then(persistent => {
console.log("StorageManager: Persistent?", persistent);
});
} else if (document.requestStorageAccess) { //Safari
document.requestStorageAccess().then(
() => console.log("StorageManager: Persistent?", true),
() => console.log("StorageManager: Persistent?", false),
);
} else {
console.log("StorageManager: Persistence unsupported");
}