google chrome extension - Can't seem to inject CSS onto YouTube? -


i'm trying inject js , css youtube pages. able inject js, see no effect when injecting css. doing incorrect or youtube limiting me in manner?

here's relevant portion of manifest.json:

  "content_scripts": [     {       "matches": ["http://www.youtube.com/watch?v*"],       "css": ["chromeextension/css/inject.css"],       "js": ["chromeextension/js/thirdparty/underscore.js", "chromeextension/js/thirdparty/jquery.js", "chromeextension/js/inject.js"]     }   ] 

i see of js injected properly, no effect css. css not appear have been injected @ all:

enter image description here

update:

curious.. injecting code works, have attempted applying '!important' css properties. these 2 methods had different effects contrasts others solutions provided on stackoverflow.

i had more success this, remain curious why more concise definition fails:

var style = document.createelement('link'); style.rel = 'stylesheet'; style.type = 'text/css'; style.href = chrome.extension.geturl('chromeextension/css/inject.css'); document.head.appendchild(style); 

there no need use !important, make sure have higher specificity in css override there. if @ body's style, should see this: enter image description here

this shows css being applied, being overridden. changing css

body.ltr{   background-color: #000; } 

will work fine.

edit: on top of that, problem might ? in match pattern. me http:///www.youtube.com/watch* works while http:///www.youtube.com/watch?* not. why affects injection of css, not js have no clue.


Comments