localStorage variable scope is different between background.html and content_script js file
Values set in local storage in background.html could not be a开发者_Go百科ccessed in javascripts loaded using content_script entry of manifest.json and vice versa. is this the default function of localstorage ? or am i missing something.
For example if i storing a value from myscript.js which is injected for each page load that could be accessible within myscript.js when i tried to access that in background.html it says undefined.
The same happens when i set a localstorage in background.html and try to accesss in myscript.js i couldn't were as it can be accessed in the page or script where it has been created or set.
Is this the default behavior or am in missing something?
This is the default behaviour.
Content scripts injected into normal webpages can't access your extension's local storage.
And your extension's manifest can't access local storage, either.
Also see Do popup.html and background.html share the same local storage?
精彩评论