I would like to with my chrome extension remove all localStorage of a specified domain
when I open the google chrome , I can remove it by going to settings -> All cookies and then find the local storage by the domain name, and delete it manually.
Here is what I get:
server.myserver.test.com
Local Storage
Source: https://server.myserver.test.com
Disk Size: 5,0 KB
Last modification: Saturday...
What would I need to do to do this inside my chrome extension, assuming that I have permission for the specified servers to access its cookies.
Thank you!
If you want to modify or clear the data in localStorage for a specific domain, then just insert a content script in the page that invokes localStorage. clear() . Save this answer.
With the extension's background page open, just go to the developer tools by pressing F12, then go to the Application tab. In the Storage section expand Local Storage. After that, you'll see all your browser's local storage there.
removeItem() : How to delete localStorage sessions To delete local storage sessions, use the removeItem() method. When passed a key name, the removeItem() method removes that key from the storage if it exists. If there is no item associated with the given key, this method will do nothing.
I think you can run content script for that specific Domain and remove local storage data by calling:
localStorage.clear();
Chrome Cookies API removes only cookies.
to used below function
chrome.storage.local.clear()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With