user5858
user5858

Reputation: 1221

What is the way to clear localStorage data in Chrome Background Extension

In the background script if I do something like:

localStorage.lastname = "Smith";

Is there any way I can clear "lastname" property like we do using History all clear in any browser? Without doing programatically and also without removing the extension?

Since HTML5 localStorage access is synchronous operation unlike chrome.storage. I just want to be sure that even though if ordinary user clears the browser history the localStorage set by the background script remains there

Upvotes: 0

Views: 1180

Answers (1)

rsanchez
rsanchez

Reputation: 14657

  1. In the chrome://extensions/ page, enable developer mode.
  2. Then click on "Inspect views: background page".
  3. That should open a Developer Tools window.
  4. In that window select the "Resources" option.
  5. Then on the left you have "Local Storage" as one of the options.
  6. Expand that option and select chrome-extension://...
  7. In the panel of the right you'll be able see all the properties set and remove them individually.

Upvotes: 1

Related Questions