分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 软件开发

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

发布时间:2023-09-06 01:58责任编辑:熊小新关键词:jsjson浏览器
 ?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 description113 ????????????"language": "en-US", ???????????????????????????????????????????// The primary language this IME is used for114 ????????????"layouts": ["us::eng"] ???????????????????????????????????????????// The supported keyboard layouts for this IME115 ????????}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 speech160 ????????"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

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

原文地址:https://www.cnblogs.com/dreamman/p/9139080.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved