Javascript 使用背景页面的Chrome扩展+;内容脚本
我很难理解Chrome扩展的结构 我的扩展有两个不同的部分:Javascript 使用背景页面的Chrome扩展+;内容脚本,javascript,google-chrome,google-chrome-extension,oauth,Javascript,Google Chrome,Google Chrome Extension,Oauth,我很难理解Chrome扩展的结构 我的扩展有两个不同的部分: 它使用一个后台页面通过oAuth登录,然后从oAuth整理大量数据并将其保存到chrome.storage.local 浏览网页时,它会调用chrome.storage.local,检查当前域是否与从oAuth存储的信息匹配,如果匹配,则使用[Rich Notifications API][1] 我的manifest.json的结构正在破坏一切 { "name": "API Test", "version": "3.1.2",
chrome.storage.local
chrome.storage.local
,检查当前域是否与从oAuth存储的信息匹配,如果匹配,则使用[Rich Notifications API][1]
manifest.json
的结构正在破坏一切
{
"name": "API Test",
"version": "3.1.2",
"manifest_version": 2,
"minimum_chrome_version": "29",
"app": {
"background": {
"scripts": ["main.js"]
}
},
"permissions": ["identity", "storage", "*://*/*"],
"oauth2": {
"client_id": "<<client_id>>",
"scopes": [
"https://www.googleapis.com/auth/plus.login",
"https://www.google.com/m8/feeds",
"https://www.googleapis.com/auth/contacts.readonly"
]
},
"content_scripts": [
{
"matches": ["*://*/*"],
"js": ["domchecker.js"]
}
]
}
这两个过程可以同时进行吗?如果没有,如何使用后台页面检查页面刷新并运行脚本 您的清单是一个应用程序清单,正如错误所提示的那样
要修复此问题,请删除应用程序
“包装”,它应该只是后台脚本
键。然后它将是一个有效的扩展清单
注意:
chrome.notifications
对内容脚本不可用;您需要使用来请求您的后台页面显示它。您的清单是一个应用程序清单,错误提示了这一点
要修复此问题,请删除应用程序
“包装”,它应该只是后台脚本
键。然后它将是一个有效的扩展清单
注意:
chrome.notifications
对内容脚本不可用;您需要使用请求您的后台页面来显示它。事实上,我已经尝试删除应用程序
“包装”,但随后我无法进行oauth登录(将所有数据加载到chrome.storage.local
)。你对此有什么建议?也许创建一个图标应用程序按钮来点击登录?当然,这是个好主意。我会帮助你的。或者,如果是一次性设置,您可以在第一次运行时显示一个选项页面。事实上,我已经尝试删除应用程序
“包装”,但随后我无法进行oauth登录(这会将所有数据加载到chrome.storage.local
)。你对此有什么建议?也许创建一个图标应用程序按钮来点击登录?当然,这是个好主意。我会帮助你的。或者,如果是一次性设置,您可以在第一次运行时显示选项页面。
There were warnings when trying to install this extension:
'content_scripts' is only allowed for extensions and
legacy packaged apps, but this is a packaged app.