MDN / browsingData.removeLocalStorage()
MDN / browsingData.removeLocalStorage()
Clears any local storage and session storage created by websites and extensions.
You can use the removalOptions parameter, which is a 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 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
This API is based on Chromium’s chrome.browsingData API.