views:

40

answers:

2

I've read all the other q's here regarding the topic but couldn't solve my problem.
I'm setting on my website the email of the user in the localStorage and i want to retrieve it in the extension.

localStorage.setItem("user", "[email protected]" ); 

But when i try to receive it with the chrome extension it fails to do so

value = localStorage.getItem("user");

Which way is easier ? cookies localstorage ? im not pretentious

A: 

Please see the information on Chrome content scripts. I'm betting you fell into the same initial trap that I did -- trying to read localStorage from an page-injected script, yes?

Michael Paulukonis
yes .. very frustrating
andrei
+1  A: 

Please see this:

http://code.google.com/chrome/extensions/content_scripts.html#host-page-communication

Content scripts are run in a separate JavaScript world, which means the content script's localStorage is different from the website's localStorage. The only thing the two share is the DOM, so you'll need to use DOM nodes/events to communicate.

Pauan