Kishan Subhash
Kishan Subhash

Reputation: 163

Access webpage's localStorage from a Chrome extension

i'm developing a chrome extension which requires to get the values(to plugin) from local storage where values are stored by some other webpages that were created by me

In short: Access a webpage's localStorage from a Chrome extension script

Upvotes: 14

Views: 7771

Answers (1)

Xan
Xan

Reputation: 77482

I just tested it, and if you access localStorage from the context of a content script, you get the webpage's localStorage. So, nothing special is required besides injecting a content script into the webpage you need.

To communicate the value from the content script you can use Messaging API, and you can use chrome.storage.local API to save data in a way that's accessible from both the content script and the background page.

Upvotes: 15

Related Questions