Question: what are the files used in chrome extension?
Answer:
Question: what is magical manifest.json?
Answer:
{
"manifest_version": 3,
"name": "extension name",
"description": "extension description",
"version": "1.0",
"permissions": [
"tabs",
"scripting",
"activeTab",
"webRequest",
"debugger"
],
"host_permissions": [
//"*://*/*"
""
],
"background": {
"service_worker": "background.js"
},
"content_scripts": [{
"css": ["content_style.css"],
"js": ["content_script.js"],
"matches": ["http://*/*", "https://*/*"],
"run_at": "document_end"
}]
}
Question: what is magical background.js?
Answer:
chrome.tabs.query({active: true, currentWindow: true}, tabs => {
console.log(tabs);
// chrome.scripting.insertCSS({
// target: {tabId: tabs[0].id},
// files: ["content_style.css"],
// });
});
Question: what is magical content_script.js?
Answer:
console.log(
'content script',
document.querySelector('body')
);
Question: what is magical background.js?
Answer:
body {
background: #2fa !important;
}