javascript - Access extensions in the chrome://extensions page -


this question has answer here:

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: enable extensions on chrome:// urls flag
  • manifest.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

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -