User:Zuhui//Prototyping/Web extension: Difference between revisions
< User:Zuhui | | Prototyping
(Created page with "so we meet again Json") |
m (Zuhui moved page User:Zuhui//SI25/Prototyping/Web extension to User:Zuhui//Prototyping/Web extension) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
so we meet again Json | so we meet again [[User:Zuhui//SI25/Prototyping/API/Who is Json and what is XML |Json]]. | ||
<br><br> | |||
===manifest.json=== | |||
from Joseph's class<br> | |||
the keys in manifest.json are predefined rules (APIs) set by the browser. can't change them nor add random stuff.<br> | |||
for <code>permissions</code>, you can only use the APIs provided by the browser. | |||
<syntaxhighlight lang="json"> | |||
{ | |||
"manifest_version": 3, //good to use latest extension version | |||
"name": "XPUB", | |||
"version": "1.0", //you can change it later when updating | |||
"permissions": ["tabs", "activeTab", "storage"], //this defines the type of the browser functions your extension would like to use | |||
"description": "Accumulates css.",<br> | |||
"action": { //extension icon will appear at the top right of the browser. this setting defines what happens when you click that icon. | |||
"default_icon": "ICON.gif", | |||
"default_popup": "popup.html", | |||
"default_title": "under" | |||
}, | |||
"content_scripts": [ //assign javascript file the extensions would run with (in every webpage) | |||
{ | |||
"matches": ["<all_urls>"], | |||
"js": ["under.js"] | |||
} | |||
], | |||
"icons": { | |||
"32": "icon.png" // 32x32pixcel icon | |||
} | |||
} | |||
</syntaxhighlight> |
Latest revision as of 09:09, 8 February 2025
so we meet again Json.
manifest.json
from Joseph's class
the keys in manifest.json are predefined rules (APIs) set by the browser. can't change them nor add random stuff.
for permissions
, you can only use the APIs provided by the browser.
{
"manifest_version": 3, //good to use latest extension version
"name": "XPUB",
"version": "1.0", //you can change it later when updating
"permissions": ["tabs", "activeTab", "storage"], //this defines the type of the browser functions your extension would like to use
"description": "Accumulates css.",<br>
"action": { //extension icon will appear at the top right of the browser. this setting defines what happens when you click that icon.
"default_icon": "ICON.gif",
"default_popup": "popup.html",
"default_title": "under"
},
"content_scripts": [ //assign javascript file the extensions would run with (in every webpage)
{
"matches": ["<all_urls>"],
"js": ["under.js"]
}
],
"icons": {
"32": "icon.png" // 32x32pixcel icon
}
}