https://github.com/startdusk/chrome-extension-demo
chrome extension demo
https://github.com/startdusk/chrome-extension-demo
Last synced: about 2 months ago
JSON representation
chrome extension demo
- Host: GitHub
- URL: https://github.com/startdusk/chrome-extension-demo
- Owner: startdusk
- License: mit
- Created: 2021-11-26T11:31:30.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-26T13:29:33.000Z (over 4 years ago)
- Last Synced: 2025-12-28T06:21:30.605Z (6 months ago)
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chrome-extension-demo
chrome extension demo
1.初始化文件
```bash
$ npm init -y
```
2.安装
```bash
$ npm i @types/chrome
```
3.设置 chrome 浏览器进入下面这个地址,选择开发者模式
```
chrome://extensions/
```
4.根目录下添加清单文件 manifest.json
参考:https://developer.chrome.com/docs/extensions/mv3/getstarted/
```json
{
"name": "my first extension",
"version": "1.0.0",
"description": "This is my very first cool extension",
"manifest_version": 3 // 当前manifest_version的最新版本是3
}
```
5.chrome 中点击 Load unpacked 选择这个项目的文件夹,就会看到加载了
6.在清单文件中注册后台运行脚本
```json
{
"name": "my first extension",
"version": "1.0.0",
"description": "This is my very first cool extension",
"manifest_version": 3, // 当前manifest_version的最新版本是3
"background": {
"service_worker": "background.js"
}
}
```