【Chrome】插件开发

 

1、谷歌浏览器扩展程序manifest.json参数详解

2、js 组合键 按键操作 

 

 

 

 

manifest.json文件

{
    "name": "名称",
    "description": "copy的接口请求头转JSON(快捷键:Ctrl+Shift+Q)",
    "author": "WeiSi",
    "version": "1.0",
    "manifest_version": 3,
    "content_scripts": [
        {
            "matches": [
                "<all_urls>"
            ],
            "js": [
                "index.js"
            ]
        }
    ],
    "commands": {
        "_execute_browser_action": {
            "suggested_key": {
                "windows": "Ctrl+Shift+Q",
                "mac": "Command+Shift+Q",
                "chromeos": "Ctrl+Shift+Q",
                "linux": "Ctrl+Shift+Q"
            }
        }
    }
}

 

查看键盘对应的key

document.addEventListener("keydown", (e)=>{
console.log(e.key, e.keyCode);
});

 

posted @ 2022-04-22 15:25  淡怀  阅读(84)  评论(0编辑  收藏  举报