{
// 清单文件的版本,这个必须写,而且必须是2
"manifest_version": 2,
// 插件的名称
"name": "Bookmark",
// 插件的版本
"version": "1.0.0",
// 插件描述
"description": "Bookmark 谷歌插件",
// 图标,一般偷懒全部用一个尺寸的也没问题
"icons":
{
    "16": "img/icon.png",
    "48": "img/icon.png",
    "128": "img/icon.png"
},
// 当某些特定页面打开才显示的图标
"page_action":
{
    "default_icon": "img/icon.png",
    "default_title": "Bookmark 谷歌插件"
},
// 权限申请
"permissions":
[
    "contextMenus", // 右键菜单
    "notifications" // 通知
],
// 会一直常驻的后台JS或后台页面
"background":
{
    "page": "background.html"
},
// 插件主页,这个很重要,不要浪费了这个免费广告位
"homepage_url": "http://sanshu.cn",
// Chrome40以前的插件配置页写法
"options_page": "options.html",
// Chrome40以后的插件配置页写法,如果2个都写,新版Chrome只认后面这一个
"options_ui":
{
    "page": "options.html",
    // 添加一些默认的样式,推荐使用
    "chrome_style": true
},
// 需要直接注入页面的JS
"content_scripts": 
[
    {
        //"matches": ["http://*/*", "https://*/*"],
        // "<all_urls>" 表示匹配所有地址
        "matches": ["<all_urls>"],
        // 多个JS按顺序注入
        "js": ["js/jquery-1.8.3.js"],
        // 代码注入的时间,可选值: "document_start", "document_end", or "document_idle",最后一个表示页面空闲时,默认document_idle
        "run_at": "document_start"
    }
]

}

最后修改:2025 年 01 月 04 日
如果觉得我的文章对你有用,请随意赞赏