Here is my mainfest.json:
"content_scripts": [ {
"all_frames": true,
"css": [ "css/event.css" ],
"matches": [ "\u003Call_urls>" ],
"run_at": "document_start"
}
but I cannot find content script in the chrome://extensions/ page
help!!!
You can do it on your PC by enabling chrome://flags/#extensions-on-chrome-urls and adding the necessary url, chrome://extensions/, into "matches" in manifest.json but such extension won't be possible to install on a normal browser due to an invalid scheme error.
To avoid the fatal error, don't use manifest.json to inject the content script/style, do it manually in the background or popup script via chrome.tabs.insertCSS or chrome.tabs.executeScript:
chrome://flags: enable Extensions on chrome:// URLs flagmanifest.json:
"permissions": ["chrome://*/*", "tabs"],
"background": {
"scripts": ["background.js"]
},
background.js:
var chromeURLstylable;
chrome.permissions.contains({origins: ["chrome://*/*"], permissions: ["tabs"]}, function(state) {
chromeURLstylable = state;
console.log("chrome:// urls support", state);
if (chromeURLstylable) {
chrome.tabs.onUpdated.addListener(function(tabId, info, tab) {
if (info.status == "loading" && tab.url.indexOf("chrome://") == 0) {
chrome.tabs.insertCSS({
file: "style.css",
runAt: "document_start",
allFrames: true
});
}
});
}
});
Beware of possible problems submitting such extension to the Chrome Webstore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With