manifest.json文件介紹


{
    // 必須
    "manifest_version": 2,  // 清單文件的版本,這個必須寫,而且必須是2
    "name": "My Extension", //
    "version": "versionString",
  
    // 推薦
    "default_locale": "en",
    "description": "A plain text description",
    "icons": {...},
  
    // 設置其中一個(或者不設置), 兩者的區別是page_action的圖標並不總是可見
    "browser_action": {...},
    "page_action": {...},
  
    // 選項
    "action": ...,
    "author": ...,
    "automation": ...,
    "background": {
    // 推薦, 背景頁面是一個全局的頁面, 他存在於擴展的整個生命周期中. 用於管理一些任務和狀態
      "persistent": false,
      "page": "",
      "scripts": ["",""] 
    },
    "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": [...]
  }
  

常用設置

"manifest_version" : 2  //用於設置chrome擴展的版本, 默認值為2, 不可修改, 不帶引號
"name": "myExt"  // 擴展的名稱, 在chrome擴展列表中展示
"version": "0.0.1",  // 擴展的版本號, 最多4個用點隔開的數字, 數字的取值為0-65535
"description": "描述"  // 擴展的描述信息, 在chrome擴展列表中展示
 
"browser_action": {}  // browser action 可以擁有一個圖標,一個tooltip,一個popup頁和一個badge
"background": {}  //  用於引用全局的js
"content_scripts": [{},{}]  //這些腳本是隔離的沙箱中運行的, 但這些腳本和他所注入的頁面共享頁面中的DOM.
 
"permissions": []  // 權限
"minimum_chrome_version": "26"  // 運行擴展需要的chrome最低版本
 
 
 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM