tynn
tynn

Reputation: 39873

Get localStorage from within extension without loading a page

I know how to get the localStorage from any open wep page by using content scripts. So I'm basically able to open a new tab with my own web page and read the storage data with a content script and message it to the background page.

But now I'd like to do this without loading an external page every time. Is there a way to access the localStorage of a page directly from within the extension? Maybe some query to chrome directly.

Upvotes: 2

Views: 1273

Answers (1)

woxxom
woxxom

Reputation: 73806

I don't see any API for that.

Your options are:

P.S. "Ironic side note" quoted from Cross-domain localStorage article by Nicholas C. Zakas.

Who knew cross-domain client-side data storage would be useful? Actually, the WHAT-WG did. In the first draft of the Web Storage specification (at that time, part of HTML5), there was an object called globalStorage that allowed you to specify which domains could access certain data. [...] The globalStorage interface was implemented in Firefox 2 prematurely as the specification was still evolving. Due to security concerns, globalStorage was removed from the spec and replaced with the origin-specific localStorage.

Upvotes: 2

Related Questions