目录结构:
myplugin
|--bg.html
|--popup.html
|--manifest.json
|--img
| |--icon.png
|--js
| |--jquery-3.1.1.min.js
|--style
|--popup.css
核心文件:
manifest.json 内容:
{
"name": "My First Extension",
"version": "1.0",
"manifest_version": 2,
"description": "The first extension that I made",
"permissions": ["tabs", "notifications","http://m.weather.com.cn/*"],
"background_page": "bg.html",
"browser_action": {
"default_icon": "img/icon.png",
"default_popup": "popup.html"
}
}
说明:permissions为插件允许的权限和允许访问的url
"manifest_version": 2, (无引号)
其它文件html,css,js和前端开发一样
最后:
在Chrome浏览器中,选择工具->扩展程序->开发模式->打包扩展程序(选择根目录
成功后再加载