Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 586
Kishan Subhash Avatar asked Apr 15 '14 10:04

Kishan Subhash


1 Answers

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.

like image 194
Xan Avatar answered Nov 03 '22 21:11

Xan