文档地址:[http://www.ituring.com.cn/minibook/950]
{
"manifest_version": 2, // 必须为2
"name": "Hello World", // 扩展名称
"description": "this is a hello world demo",
"version": "1.0.1",
"icons": {
"48": "images/icon.png",
"16": "images/icon.png"
},
// 扩展图片放在Chrome工具栏中
"browser_action": {
"default_icon": "images/icon.png", // 图标
"default_title": "Hello World", // title
"default_popup": "tpl/popup.html" // 点击所显示的页面
},
// 扩展的设置页面,右键点击扩展显示该页面
"options_page": "tpl/options.html",
"content_scripts": [{
"all_frames": true, // 标识脚本是否会注入到嵌入式框架中
"js": [ "js/jquery.js","js/background.js" ], // 注入js
"matches": [ "*://*.baidu.com/*"], // 匹配注入的网址
"run_at": "document_start" // 注入时间
}],
// 需要的权限
"permissions": [
"tabs", // 访问浏览器选项卡
"activeTag", // 获取当前活动的选项卡
"notifications", // 浏览器通知
"storage", // 浏览器存储
"http://*/" // http请求
],
// 启动扩展时,自动引入的js文件
"background": {
"scripts": ["js/jquery.js"]
},
// 该属性可以自定义页面替换chrome相应的默认页面,
// 比如新标签页(newtab),书签页面(bookmarks)
// 历史记录(history)
"chrome_url_overrides": {
"newtab": "tpl/tab.html" // html中不可以写js
},
// 网络通信
"sockets": {
"tcp": {
// 表示可以与180.149.132.47的80端口和任意主机的8080端口TCP通信
"connect":["180.149.132.47:80",":8080"]
}
}
}