从零开始写一个chrome插件(三)-- 了解配置文件各字段功能(01)

  1. manifest.json里面的所有字段。直接复制粘贴过来镇楼。
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    {
    // Required
    "manifest_version": 2,
    "name": "My Extension",
    "version": "versionString",

    // Recommended
    "default_locale": "en",
    "description": "A plain text description",
    "icons": {...},

    // Pick one (or none)
    "browser_action": {...},
    "page_action": {...},

    // Optional
    "action": ...,
    "author": ...,
    "automation": ...,
    "background": {
    // Recommended
    "persistent": false
    },
    "background_page": ...,
    "chrome_settings_overrides": {...},
    "chrome_ui_overrides": {
    "bookmarks_ui": {
    "remove_bookmark_shortcut": true,
    "remove_button": true
    }
    },
    "chrome_url_overrides": {...},
    "commands": {...},
    "content_capabilities": ...,
    "content_scripts": [{...}],
    "content_security_policy": "policyString",
    "converted_from_user_script": ...,
    "current_locale": ...,
    "declarative_net_request": ...,
    "devtools_page": "devtools.html",
    "event_rules": [{...}],
    "externally_connectable": {
    "matches": ["*://*.example.com/*"]
    },
    "file_browser_handlers": [...],
    "file_system_provider_capabilities": {
    "configurable": true,
    "multiple_mounts": true,
    "source": "network"
    },
    "homepage_url": "http://path/to/homepage",
    "import": [{"id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}],
    "incognito": "spanning, split, or not_allowed",
    "input_components": ...,
    "key": "publicKey",
    "minimum_chrome_version": "versionString",
    "nacl_modules": [...],
    "oauth2": ...,
    "offline_enabled": true,
    "omnibox": {
    "keyword": "aString"
    },
    "optional_permissions": ["tabs"],
    "options_page": "options.html",
    "options_ui": {
    "chrome_style": true,
    "page": "options.html"
    },
    "permissions": ["tabs"],
    "platforms": ...,
    "requirements": {...},
    "sandbox": [...],
    "short_name": "Short Name",
    "signature": ...,
    "spellcheck": ...,
    "storage": {
    "managed_schema": "schema.json"
    },
    "system_indicator": ...,
    "tts_engine": {...},
    "update_url": "http://path/to/updateInfo.xml",
    "version_name": "aString",
    "web_accessible_resources": [...]
    }

2.必填的基本配置线

  • manifest_version

    声明manifest.json文件的版本格式,纯数字,不需要用引号括起来。chrome18及以上声明为2,
    18以下声明为1,在不元的将来,不排除废除的可能性。但目前还是必须的。
  • name/short_name

    扩展的名字,字符串。name最长为45个字符,经测试,超过长度也没事,应该是建议长度。
    short_name为12。非必选。
  • version

    插件的版本号,要求是插件,必须位于0到6535之间,但不包括0,且不能从零开始。
    配套的 version_name属性可以用来描述version。允许字符串和数字组合。
  1. 推荐的选项
    • default_locale

      多语言配置,需要有一个_locals文件夹,里面用来存放多语言的自负床。
    • description

      用来描述插件,有利用在应用商店的搜索。