在google-chrome中为不同的网站设置内容脚本

Fra*_*yer 3 google-chrome google-chrome-extension

我查看了google-chrome-extension labs页面,但我没有看到任何可以为不同站点使用不同内容脚本的示例.他们有一个页面显示如何在一个站点上拥有多个内容脚本,但反之则不然.有没有办法为不同的网站提供不同的内容脚本?

ser*_*erg 5

{
  "name": "My extension",
  ...
  "content_scripts": [
    {
      "matches": ["http://www.google.com/*"],
      "js": ["script1.js"]
    },{
      "matches": ["http://www.yahoo.com/*"],
      "js": ["script2.js"]
    }
  ],
  ...
}
Run Code Online (Sandbox Code Playgroud)