Reputation: 3215
In my content script I have done following :
document.onreadystatechange = function(){
localStorage["options"] = "yes";
}
If I try to access this localStorage["options"] in my options.html page. it is giving me undefined error.
What can I do to access this content?
My Requirement : I need to get some data from the page source of a specific page and store it in localStorage. Then i need to process this data in my options.html page.
Edit : I am able to access the localStorage created in the options page in my background page. But I can't access localStorage created in content script in the options page.
Upvotes: 1
Views: 3110
Reputation: 18119
Unfortunately, that's not a bug. You've hit a limitation in Chrome's extension sandboxing. Background and options pages don't share cookies, localStorage, or any other JS persistence that you would expect to work on the same "domain" (read: extension).
The solution is to use messaging, as described in the docs: Message Passing
Upvotes: 5