I have been in the process of creating a Chrome Extension, and unfortunately, when I tried to make it work on specific URLs, I encountered an issue. While Chrome has options like exclude_matches
and exclude_globs
for this purpose, there seems to be a bug in Chrome when using these options along with CSS - it simply does not work.
I am looking for alternative methods to inject my CSS only on certain domains (excluding a few rather than allowing many). I am aware that I can use JavaScript to add the CSS at the end of the existing file, but this causes a delay in displaying the CSS, which is quite noticeable.
If anyone has any suggestions or ideas on how to achieve this without affecting performance, please let me know. Perhaps there is a way to link the CSS file via JavaScript without the need for domain exclusion since exclude_matches
works well with JS files. Any input is appreciated, especially considering Google's delayed response in fixing this year-old bug!
EDIT: In anticipation of questions about Programmatic Injection, I would like to clarify that I am unsure about its functioning. To provide an example, we can consider the following links (with the last one being where I do not want the CSS implemented) in case someone wants to share a sample solution.
http://example.com/
http://example.com/random/
http://example.com/random/example/
Also, while I understand that Google's example involves using a button to trigger the CSS application, I prefer having it initialize upon page load. Thank you once again!