I'm injecting some JavaScript (JS) code into a pre-existing website with a Google Chrome extension that I'm building.
The JS gets injected every time I reload the extension and the webpage but my CSS doesn't always get applied. Unlike the JS, which I inject into the webpage's DOM using my content script, I apply the CSS using this code:
"content_scripts": [{
"matches": ["https://aparticularwebsite.com/*"],
"js": ["js/myContentScript.js"],
"css": ["css/myCss.css"],
"all_frames": true,
"run_at": "document_end"
}]
Should I also be injecting my CSS into the DOM using the same method that JS gets injected?
For definitions of 'injected script' and 'content script' see the first answer to this question.