browsingData.removeLocalStorage()
Clears any local storage and session storage created by websites and extensions.
Clears any local storage and session storage created by websites and extensions.
You can use the removalOptions parameter, which is a browsingData.RemovalOptions object, to:
- clear local and session storage values created after a given time.
- control whether to clear localStorage and sessionStorage values created by web pages or web pages extensions.
Syntax
let removing = browser.browsingData.removeLocalStorage(
removalOptions // RemovalOptions object
)
Parameters
removalOptions- :
object. A browsingData.RemovalOptions object, which can be used to clear localStorage and sessionStorage values stored after a given time, and control whether to clear localStorage and sessionStorage objects created by web pages, or web pages and extensions.
Return value
A Promise that is fulfilled with no arguments when the removal has finished. If any error occurs, the promise is rejected with an error message.
Examples
Remove all local storage:
function onRemoved() {
console.log("removed");
}
function onError(error) {
console.error(error);
}
browser.browsingData.removeLocalStorage({}).then(onRemoved, onError);
Browser compatibility
[!NOTE] This API is based on Chromium's
chrome.browsingDataAPI.