zoukankan      html  css  js  c++  java
  • 谷歌浏览器扩展程序manifest.json参数详解

      1 {
      2     // Required
      3     "manifest_version": 2,                        // manifest编写规范版本,目前主流2
      4     "name": "My Extension",                        // 插件名
      5     "version": "versionString",                    // 版本号
      6 
      7     // Recommended
      8     "default_locale": "en",                        // 默认编码
      9     "description": "A plain text description",     // 插件描述
     10     "icons": {                                    // 插件下载或浏览时显示的图标,可选多种规格,建议128
     11         "16": "icon16.png",
     12         "48": "icon48.png",
     13         "128": "icon128.png"
     14     },
     15 
     16     // Pick one (or none)
     17     "browser_action": {},                        // 图标显示在地址栏右边,能在所有页面显示
     18     "page_action": {},                            // 图标显示在地址栏右侧(地址栏内),只在特定页面显示
     19 
     20     // Optional
     21     "author": "",                                // 插件作者
     22     "automation": true,                            // 开启自动化
     23     "background": {                                // 可常驻浏览器后台的脚本,可以连接其他页面
     24         // Recommended
     25         "persistent": false,
     26         "script": ["background.js"]
     27     },
     28     "background_page": ,
     29     "chrome_settings_overrides": {},            // 覆盖当前的chrome配置
     30     "chrome_ui_overrides": {                    // 覆盖当前的chrome界面配置
     31         "bookmarks_ui": {
     32         "remove_bookmark_shortcut": true,
     33         "remove_button": true
     34         }
     35     },
     36     "chrome_url_overrides": {                    // 修改点击相应动作时返回的页面链接,只支持bookmarks、history、newtab三个页面
     37         "bookmarks": "myPage.html",
     38         "history": "myPage.html",
     39         "newtab": "myPage.html"
     40     },
     41     "commands": {                                // 键盘触发插件快捷键
     42         "_execute_browser_action": {
     43             "suggested_key": {
     44                 "windows": "Ctrl+Shift+Y",
     45                 "mac": "Command+Shift+Y",
     46                 "chromeos": "Ctrl+Shift+U",
     47                 "linux": "Ctrl+Shift+J"
     48             }
     49          },
     50     },
     51     "content_capabilities": {                                                // 页面权限
     52         "matches": ["https://*.nyc.corp.google.com/*"],
     53         "permissions": ["unlimitedStorage", "notifications"] 
     54     },
     55     "content_scripts": [{                                                    // 可以操作页面元素,不能使用chrome的api
     56         "matches": ["http://www.google.com/*"],
     57         "css": ["mystyles.css"],
     58         "js": ["jquery.js", "myscript.js"]
     59     }],
     60     "content_security_policy": "script-src 'self'; object-src 'self'",        // 安全策略,默认情况下禁止使用eval或者Function构造函数,以及内联js,禁止载入外部脚本
     61     "converted_from_user_script": true,                                        // 将用户脚本转化为content script,允许使用GM_* (greasemonkey)方法
     62     "copresence": ,
     63     "current_locale": ,
     64     "devtools_page": "devtools.html",                                        // 在开发中工具中的页面
     65     "event_rules": [{                                                        // 事件监听规则及条件
     66         "event": "declarativeContent.onPageChanged",
     67         "actions": [{
     68             "type": "declarativeContent.ShowPageAction"
     69         }],
     70         "conditions": [{
     71             "type": "declarativeContent.PageStateMatcher",
     72             "css": ["video"]
     73         }]
     74     }],
     75     "externally_connectable": {                                                // 哪些外部扩展、应用或网页能连接此插件
     76         "ids": [
     77             "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
     78             "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
     79             "*"                                                                // 允许所有可使用 "*"
     80         ],
     81         "matches": ["*://*.example.com/*"],
     82         "accepts_tls_channel_id": false
     83     },
     84     "file_browser_handlers": [{                                                // 允许用户上传文件,只支持Chrome OS
     85         "id": "upload",
     86         "default_title": "Save to Gallery",                                 // 按钮文字
     87         "file_filters": [
     88             "filesystem:*.jpg",                                             // 匹配所有文件可用 "filesystem:*.*"
     89             "filesystem:*.jpeg",
     90             "filesystem:*.png"
     91         ]
     92     }],
     93     "file_system_provider_capabilities": {                                    // 允许访问文件系统,只支持Chrome OS
     94         "configurable": true,
     95         "multiple_mounts": true,
     96         "source": "network"
     97     },
     98     "homepage_url": "http://path/to/homepage",                                // 插件主页,显示在chrome扩展工具列表中
     99     "export": {                                                                // 允许其他组件调用自己的模块
    100         "whitelist": [
    101             "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    102             "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
    103         ]
    104     },
    105     "import": [{"id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}],                    // 调用其他组件的模块,与其他组件的export属性共用
    106     "incognito": "spanning or split or not_allowed",                        // 隐身模式
    107     "input_components": [                                                    // 输入管理,键盘事件等
    108         {
    109             "name": "Test IME",
    110             "type": "ime",
    111             "id": "test",
    112             "description": "Test IME",                                        // A user visible description
    113             "language": "en-US",                                            // The primary language this IME is used for
    114             "layouts": ["us::eng"]                                            // The supported keyboard layouts for this IME
    115         }
    116     ],
    117     "key": "publicKey",                                                        // 自动生成,可不需要
    118     "minimum_chrome_version": "versionString",                                // 要求支持的chrome的最低版本
    119     "nacl_modules": [{                                                        // 使用native client 模块
    120         "path": "OpenOfficeViewer.nmf",
    121         "mime_type": "application/vnd.oasis.opendocument.spreadsheet"
    122     }],
    123     "oauth2": ,                                                                // 谷歌账户相关信息
    124     "offline_enabled": true,                                                // 离线使用
    125     "omnibox": {                                                            // 搜索关键词推荐
    126         "keyword": "aString"
    127     },
    128     "optional_permissions": ["tabs"],                                        // 运行时权限,非必须权限
    129     "options_page": "options.html",                                            // 设置页,可从扩展工具列表进入
    130     "options_ui": {                                                            // 设置页
    131         "chrome_style": true,
    132         "page": "options.html"
    133     },
    134     "permissions": ["tabs"],                                                // 安装时提示的权限,基本权限
    135     "platforms": ,                                                            // 可以将部分基于平台的功能文件放入_platform_specific目录然后列在此项中减少插件体积
    136     "plugins": [{ "path": "extension_plugin.dll" }],                        // NPAPI插件
    137     "requirements": {                                                        // 安装前置需求
    138         "3D": {
    139             "features": ["webgl"]
    140         }
    141     },
    142     "sandbox": [                                                            // 放入沙盒中运行
    143         {
    144             "pages": [
    145                 "page1.html",
    146                 "directory/page2.html"
    147             ],
    148             // content_security_policy is optional.
    149             "content_security_policy": "sandbox allow-scripts; script-src https://www.google.com"
    150         }
    151     ],
    152     "short_name": "Short Name",                                                // 短名称,最长12个字母,如不设置则用name属性代替
    153     "signature": ,
    154     "spellcheck": ,                                                            // 拼写检查
    155     "storage": {                                                            // 描述了各种属性的type,json格式文件,能在storage.managed API中调用
    156         "managed_schema": "schema.json"
    157     },
    158     "system_indicator": ,                                                    // 实验性API,只在开发版中实现,已弃用
    159     "tts_engine": {                                                            // text to speech
    160         "voices": [
    161             {
    162                 "voice_name": "Alice",
    163                 "lang": "en-US",
    164                 "gender": "female",
    165                 "event_types": ["start", "marker", "end"]
    166             },
    167             {
    168                 "voice_name": "Pat",
    169                 "lang": "en-US",
    170                 "event_types": ["end"]
    171             }
    172         ]
    173     },                                                        
    174     "update_url": "http://myhost.com/mytestextension/updates.xml",            // 插件更新地址
    175     "version_name": "aString",                                                // 版本名,和version字段的区别是没有格式要求,任意字符串
    176     "web_accessible_resources": ["images/*.png"]                            // 指定本扩展在注入的目标页面上所需使用的资源的路径
    177 }

    url:https://blog.csdn.net/sysuzjz/article/details/51648163

  • 相关阅读:
    Python匿名函数详解
    python开发 -- 经常浏览的网站
    Python -- 变量指向
    我的Python开发之路---微信网页授权(扫码登陆)
    信息收集篇:玩转信息收集(一)
    TodoList:适合初学者的vue+node小项目
    节流和防抖的实现
    javascript的this问题
    bind、call、apply的区别与实现
    杜教筛
  • 原文地址:https://www.cnblogs.com/dreamman/p/9139080.html
Copyright © 2011-2022 走看看