我的 chrome 扩展有两种状态: 1. 某些站点在 localStorage(另一个域)中有身份验证数据,所以我必须显示主窗口。2.没有身份验证数据,所以我必须显示带有登录名和密码表单的窗口。
为了定义是否提供身份验证数据,我想检查他的 localStorage,但看起来不可能。
但是,chrome.storage.local.get并且chrome.storage.local.set非常适合扩展的 localStorage。
或者有没有办法做到这一点 - 访问另一个站点的 localStorage ?
我正在尝试与位于Chrome扩展程序弹出窗口中的iframe进行交互.我知道可以使用manifest.json在所有帧中注入content.js,但是它在网页中使用框架而不是在扩展的弹出窗口内.
它可行吗?我尝试了很多东西,但我还没有找到解决方案.
我的清单:
{
"name" :"test",
"version": "1.0",
"manifest_version": 2,
"description" :"Scraping Facebook",
"permissions": [
"cookies",
"background",
"tabs",
"http://*/*",
"https://*/*",
"storage",
"unlimitedStorage"
],
"icons": { "128": "images/pint.png" },
"content_scripts": [
{
"matches": [
"http://*/*",
"https://*/*"
],
"js": ["jquery-3.1.0.min.js","content.js"],
"run_at":"document_end"
}
],
"web_accessible_resources": [
"http://*/*",
"https://*/*",
"styles/*",
"fonts/*"
],
"background": {
"scripts": ["background.js"]
},
"browser_action" :
{
"default_popup": "popup.html",
"default_title": "test"
}
}
Run Code Online (Sandbox Code Playgroud)