aboutsummaryrefslogtreecommitdiff
path: root/files/ar/mozilla/add-ons/webextensions/manifest.json/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ar/mozilla/add-ons/webextensions/manifest.json/index.html')
-rw-r--r--files/ar/mozilla/add-ons/webextensions/manifest.json/index.html109
1 files changed, 109 insertions, 0 deletions
diff --git a/files/ar/mozilla/add-ons/webextensions/manifest.json/index.html b/files/ar/mozilla/add-ons/webextensions/manifest.json/index.html
new file mode 100644
index 0000000000..332566c368
--- /dev/null
+++ b/files/ar/mozilla/add-ons/webextensions/manifest.json/index.html
@@ -0,0 +1,109 @@
+---
+title: manifest.json
+slug: Mozilla/Add-ons/WebExtensions/manifest.json
+tags:
+ - Add-ons
+ - Extensions
+ - NeedsTranslation
+ - TopicStub
+ - WebExtensions
+translation_of: Mozilla/Add-ons/WebExtensions/manifest.json
+---
+<div>{{AddonSidebar}}</div>
+
+<p>The manifest.json file is a <a href="/en-US/docs/Glossary/JSON">JSON</a>-formatted file, and is the only file that every extension using WebExtension APIs must contain.</p>
+
+<p>Using manifest.json, you specify basic metadata about your extension such as the name and version, and can also specify aspects of your extension's functionality, such as background scripts, content scripts, and browser actions.</p>
+
+<p>manifest.json keys are listed below:</p>
+
+<div class="twocolumns">{{ ListSubpages ("/en-US/Add-ons/WebExtensions/manifest.json") }}</div>
+
+<div class="twocolumns"> </div>
+
+<p><code>"manifest_version"</code>, <code>"version"</code>, and <code>"name"</code> are the only mandatory keys. <code>"default_locale"</code> must be present if the "_locales" directory is present and must be absent otherwise. <code>"applications"</code> is not supported in Google Chrome, and is mandatory in Firefox before Firefox 48 and Firefox for Android.</p>
+
+<p>You can access your extension's manifest from the extension's JavaScript using the {{WebExtAPIRef("runtime.getManifest()")}} function:</p>
+
+<pre class="brush: js">browser.runtime.getManifest().version;</pre>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+<p>{{Compat("webextensions.manifest")}}</p>
+
+<h2 id="Example">Example</h2>
+
+<p>Quick syntax example for manifest.json:</p>
+
+<pre class="brush: json">{
+ "applications": {
+ "gecko": {
+ "id": "addon@example.com",
+ "strict_min_version": "42.0"
+ }
+ },
+
+ "background": {
+ "scripts": ["jquery.js", "my-background.js"],
+ "page": "my-background.html"
+ },
+
+ "browser_action": {
+ "default_icon": {
+ "19": "button/geo-19.png",
+ "38": "button/geo-38.png"
+ },
+ "default_title": "Whereami?",
+ "default_popup": "popup/geo.html"
+ },
+
+ "commands": {
+ "toggle-feature": {
+  "suggested_key": {
+    "default": "Ctrl+Shift+Y",
+    "linux": "Ctrl+Shift+U"
+  },
+     "description": "Send a 'toggle-feature' event"
+ }
+ },
+
+ "content_security_policy": "script-src 'self' https://example.com; object-src 'self'",
+
+ "content_scripts": [
+ {
+ "exclude_matches": ["*://developer.mozilla.org/*"],
+ "matches": ["*://*.mozilla.org/*"],
+ "js": ["borderify.js"]
+ }
+ ],
+
+ "default_locale": "en",
+
+ "description": "...",
+
+ "icons": {
+ "48": "icon.png",
+ "96": "icon@2x.png"
+ },
+
+ "manifest_version": 2,
+
+ "name": "...",
+
+ "page_action": {
+ "default_icon": {
+ "19": "button/geo-19.png",
+ "38": "button/geo-38.png"
+ },
+ "default_title": "Whereami?",
+ "default_popup": "popup/geo.html"
+ },
+
+ "permissions": ["webNavigation"],
+
+ "version": "0.1",
+
+ "web_accessible_resources": ["images/my-image.png"]
+}</pre>
+
+<p> </p>