是否popup.html和background.html共享相同的本地存储? [英] Do popup.html and background.html share the same local storage?

查看:204
本文介绍了是否popup.html和background.html共享相同的本地存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我理解正确,popup.html和background.html共享相同的本地存储,因为它们在同一个沙箱中运行。而且内容脚本在另一个沙箱中运行后不会共享同一个脚本。对吗?

If I understand correctly, popup.html and background.html share the same local storage since they run in the same sandbox. And content script does not share the same one since it run in another sandbox. Right?

推荐答案

正确。从Chrome扩展的后台页面调用 localStorage ,浏览器操作页面或页面操作页面使用扩展的本地存储。

Correct. Calling localStorage from a Chrome extension's Background page, Browser Action page or Page Action page uses the extension's local storage.

内容脚本只能在普通网页上运行,并且通常无法访问Chrome的扩展API,因此其本地存储访问权限将限制在特定网站的本地存储中。

Content scripts only run on normal web pages and generally can't access Chrome's extension API, so their local storage access would be limited to the specific website's local storage.

这篇关于是否popup.html和background.html共享相同的本地存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆