(二)Manifest文件结构

来源:互联网 发布:访问网络电脑需要密码 编辑:程序博客网 时间:2024/05/02 01:17
  1. json 有两种结构
    一种是键值对,即key:value
    json1

    一种是纯值的
    json2

    举个栗子:

    {    "name" : "Harry Potter",    "author" : {        "name" : "J.K.Rowling",        "birth" : 1964    },    "books" : [        "Philosopher's Stone",        "Chamber of Secrets",        "Prisoner of Azkaban",        "Goblet of Fire",        "Order of the Phoenix",        "Half-Blood Prince",        "Deathly Hallows"    ]}
  2. manifest 必备内容

    • Chrome扩展的Manifest 必须 包含nameversionmanifest_version属性,目前来说manifest_version属性值只能为数字2,对于应用来说,还必须包含app属性。
  3. 可套用模板

{    "app": {        "background": {            "scripts": ["background.js"]        }    },    "manifest_version": 2,    "name": "My Extension",    "version": "versionString",    "default_locale": "en",    "description": "A plain text description",    "icons": {        "16": "images/icon16.png",        "48": "images/icon48.png",        "128": "images/icon128.png"    },    "browser_action": {        "default_icon": {            "19": "images/icon19.png",            "38": "images/icon38.png"        },        "default_title": "Extension Title",        "default_popup": "popup.html"    },    "page_action": {        "default_icon": {            "19": "images/icon19.png",            "38": "images/icon38.png"        },        "default_title": "Extension Title",        "default_popup": "popup.html"    },    "background": {        "scripts": ["background.js"]    },    "content_scripts": [        {            "matches": ["http://www.google.com/*"],            "css": ["mystyles.css"],            "js": ["jquery.js", "myscript.js"]        }    ],    "options_page": "options.html",    "permissions": [        "*://www.google.com/*"    ],    "web_accessible_resources": [        "images/*.png"    ]}
0 0
原创粉丝点击