StephenD
StephenD

Reputation: 4122

Clear the storage persistent flag for a website

I'm using the navigator.storage.persist() API on Chrome, and have managed to get it set to true. But I would like to (at least for testing) be able to clear the setting putting back to false.

The API definition does not include a method or flag to clear as far as I can tell. See https://developer.mozilla.org/en-US/docs/Web/API/StorageManager and the living standard: https://storage.spec.whatwg.org/#storagemanager

However, for my purposes it would also be acceptable if there was a way from 'Site settings', the clear cache options, or even a custom page like the chrome://appcache-internals/ page for appcache.

If not, where does the flag get stored? i.e. what would I need to delete in the file system to reset things?

Upvotes: 4

Views: 942

Answers (1)

Alexander Abakumov
Alexander Abakumov

Reputation: 14539

I has not been able to find a way to clear the flag for a specific website.

But for testing purposes (as you requested), the flag returned by the StorageManager.persisted() can be cleared by:

  1. navigate to chrome://settings/?search=cooki
  2. click on Clear browsing data
  3. select Cookies and other site data in the popup and click Clear data button

After performing the above steps, StorageManager.persisted() starts to return false.

Upvotes: 2

Related Questions