Javascript Chrome扩展:根据您所在的站点运行不同的.js文件';你在吗?

Javascript Chrome扩展:根据您所在的站点运行不同的.js文件';你在吗?,javascript,html,google-chrome,google-chrome-extension,content-script,Javascript,Html,Google Chrome,Google Chrome Extension,Content Script,我是chrome扩展的新手,但我有一个关于内容脚本的问题 如果用户访问特定的域,我想执行一个特定的js文件,如果用户访问不同的域,我想执行另一个不同的js文件 我的问题是,如何在manifest.json文件中实现这一点 这就是我到目前为止所做的: "content_scripts": [{"matches": ["http://store.example.com/*"], "js": ["store.js"]}], [{"matches": ["

我是chrome扩展的新手,但我有一个关于内容脚本的问题

如果用户访问特定的域,我想执行一个特定的js文件,如果用户访问不同的域,我想执行另一个不同的js文件

我的问题是,如何在manifest.json文件中实现这一点

这就是我到目前为止所做的:

    "content_scripts": 
         [{"matches": ["http://store.example.com/*"], "js": ["store.js"]}], 
         [{"matches": ["https://purchase.example.com/*"], "js": ["purchase.js"]}]

    "permissions":["tabs", "http://store.example.com/*"]

但我一直在犯错误。谢谢

内容脚本声明的格式不正确。试试这个:

"content_scripts": [
    {"matches": ["http://store.example.com/*"], "js": ["store.js"]},
    {"matches": ["https://purchase.example.com/*"], "js": ["purchase.js"]}
],