Home > Blockchain >  What is the stylesheet injected by Chrome in local extension pages?
What is the stylesheet injected by Chrome in local extension pages?

Time:07-30

I have noticed that on local extension pages, Chrome will inject some styles of its own that are different on different operating systems. For example, here's the injected styles on Chrome Beta on Windows, for the uBlock origin dashboard (chrome-extension://cjpalhdlnbpafiamejdnhcphjbkeiagm/dashboard.html#settings.html):

windows devtools screenshot

The images of the same page for Chrome Dev on Linux and Brave browser on macOS are linked.

Currently I am migrating my extension page from a local HTML to a website. Chrome does not inject these styles on the website, so it looks different than my local extension page.

Thus, I want to ask how I can find the full source of this injected stylesheet, so that I can manually implement those styles on my website page.

CodePudding user response:

Font-family and size are injected in all extension pages: extension_fonts.css.
The font size differs from a usual html page, which may be a bug in Chromium.

A big extension.css is injected in a ManifestV2 extension options page declared with chrome_style key in manifest.json: "options_ui": {"chrome_style": true, "page": "options.html"}.
ManifestV3 doesn't allow it.

  • Related