最終更新:2014-02-05 (水) 12:17:59 (1441d)  

manifest.json はてなブックマークを見る
Top / manifest.json

拡張機能の名前や動き、使用するファイルなどを定義するためのファイル

http://code.google.com/chrome/extensions/manifest.html

バージョン

バージョン1

  • Manifest version 1 was deprecated in Chrome 18
    {
    // 必須
    "name": "サンプル",/*(45文字以下*/
    "version": "1.0.0",
    
    // 書いた方が良い
    "description": "これはサンプルの拡張機能です。",/*132文字以下*/
    "icons": {/*PNG形式推奨、他にBMP、GIF、JPEG、ICOファイルに対応*/
    	"48": "48x48.png",
    	"128": "128x128.png"
    },

バージョン2

  • 最低限は下記
    {
    "name": "拡張機能の名前",
    "version": "拡張機能のバージョン",
    "manifest_version": 2,
    },

変更点

  • content_security_policyの追加
    script-src 'self'; object-src 'self'
  • web_accessible_resourcesの追加
    • A package's resources are no longer available by default to external websites (as the src of an image, or a script tag)
  • background_pageがbackgroundに変更
  • ブラウザアクションの変更
    • The browser_actions key in the manifest, and the chrome.browserActions API are gone.
    • The icons property of browser_action has been removed.
      • Use the default_icon? property or chrome.browserAction.setIcon? instead.
    • The name property of browser_action has been removed.
      • Use the default_title? property or chrome.browserAction.setTitle? instead.
    • The popup property of browser_action has been removed.
      • Use the default_popup? property or chrome.browserAction.setPopup? instead.
    • The default_popup property of browser_action can no longer be specified as an object. It must be a string.
  • ページアクションの変更
    • The page_actions key in the manifest, and the chrome.pageActions API are gone.
      • Use the singular page_action? and chrome.pageAction? instead.
    • The icons property of page_action has been removed.
      • Use the default_icon? property or chrome.pageAction.setIcon? instead.
    • The name property of page_action has been removed.
      • Use the default_title? property or chrome.pageAction.setTitle? instead.
    • The popup property of page_action has been removed.
      • Use the default_popup property or chrome.pageAction.setPopup? instead.
    • The default_popup property of page_action can no longer be specified as an object. It must be a string.
    • The chrome.self API has been removed.
  • chrome.extension.getTabContentses? (!!!) and chrome.extension.getExtensionTabs? are gone.
    • Use chrome.extension.getViews({ "type": "tab" }) instead.
  • Port.tab is gone. Use Port.sender instead.

メモ

  • HTML 内へ直接 JavaScript の記述が不可に

項目

https://developer.chrome.com/extensions/manifest.html

サンプル

{
// 必須
"name": "サンプル",/*(45文字以下*/
"version": "1.0.0",

// 書いた方が良い
"description": "これはサンプルの拡張機能です。",/*132文字以下*/
"icons": {/*PNG形式推奨、他にBMP、GIF、JPEG、ICOファイルに対応*/
	"48": "48x48.png",
	"128": "128x128.png"
},

// 用途に応じて一つ選択
"browser_action": {
	"default_icon": "tooltip.png",
	"default_title": "Tooltip Message",
	"popup": "popup.html"
},
"page_action": {
	"default_icon": "tooltip.png",
	"default_title": "Tooltip Message",
	"popup": "popup.html"
},
"content_scripts": [
	{
		"js": [
			"x.js",
			"bookmark.js"
		],
		"css": [
		"bookmark.css"
		],
		"matches": [
			"http://*/*"
		]
	}
],

"theme": {...},

// 必要ならば書く
"background_page": "bgpage.html",
"chrome_url_overrides": {
	"newtab": "newpage.html"
},
"content_scripts": [...],
"options_page": "optpage.html",/*拡張機能ページのオプションを押したときのページ*/
"permissions": [...],
"plugins": [...],
"update_url": "http://path/to/updateInfo.xml"
}

関連

参考