Skip to content

How to load css file without xhr warning? #1180

Answered by tophf
giggity-hub asked this question in Q&A
Discussion options

You must be logged in to vote

Do you also get that warning message

Yes. You can hide it by right-clicking it in devtools console.

I'm loading the css content for the style tag from a web accessible resource

Don't do it. Put the code inside the inline string as I shown originally. If you use a build system there should be a plugin that reads a file and puts its contents instead of a predefined placeholder.

The only alternative is to read the file in the background script in chrome.webNavigation.onBeforeNavigation, store it in a global variable, then send via message to the content script. But it's really an unnecessary complication in case of a single-theme extension.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@giggity-hub
Comment options

@tophf
Comment options

tophf Feb 12, 2021
Collaborator

Answer selected by giggity-hub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants