Chrome扩展程序-需要在内容脚本中添加chrome.browser操作

时间:2018-07-19 20:47:26

标签: google-chrome-extension

所以基本上我需要做几件事

  1. chrome.webrequests.onBeforeRequest.addlisteners
  2. chrome.browser.addbadgetext
  3. chrome.tabs.query

在内容脚本中。我之所以要在内容脚本中使用该脚本,是因为我希望以上这些触发而不单击活动页面上的扩展图标。我该怎么办?

下面是我的manifest.json

{
"manifest_version": 2,
"name": "My Ext",
"description": "My Ext desc",
"icons": { 
    "16":"logo-sm.png", 
    "48":"logo-sm.png", 
    "128":"logo-sm.png" 
},
"version": "1.0",
"homepage_url": "abc.com",
"browser_action": {
    "default_icon": "favicon.png",
    "default_title": "My ext"
},
"background": {
    "scripts": ["scripts/background.js"],
    "persistent": true
},
"web_accessible_resources": ["oxy-logo-sm.png"],
"content_scripts": [{
    "matches": ["<all_urls>"],
    "all_frames": true,
    "js":["scripts/content.js"],
   "run_at": "document_start"   
}],
"permissions": ["activeTab", "webRequest", "tabs", "<all_urls>"]

}

0 个答案:

没有答案