javascript - Access extensions in the chrome://extensions page -
this question has answer here:
- can access chrome:// pages extension? 3 answers
here mainfest.json:
"content_scripts": [ { "all_frames": true, "css": [ "css/event.css" ], "matches": [ "\u003call_urls>" ], "run_at": "document_start" } but cannot find content script in chrome://extensions/ page
help!!!
you can on pc enabling chrome://flags/#extensions-on-chrome-urls , adding necessary url, chrome://extensions/, "matches" in manifest.json such extension won't possible install on normal browser due invalid scheme error.
to avoid fatal error, don't use manifest.json inject content script/style, manually in background or popup script via chrome.tabs.insertcss or chrome.tabs.executescript:
chrome://flags: enableextensions on chrome:// urlsflagmanifest.json:
"permissions": ["chrome://*/*", "tabs"], "background": { "scripts": ["background.js"] },background.js:
var chromeurlstylable; chrome.permissions.contains({origins: ["chrome://*/*", "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 chrome webstore.
Comments
Post a Comment