Can a WebExtension inject scripts into chrome:// and about: pages?

Hi everyone,

I’m developing an Android app that embeds GeckoView and uses a WebExtension. I need to modify some internal pages, specifically pages loaded via chrome:// and about:xxx protocols (for example, about:config, whose underlying URL appears to be chrome://geckoview/content/config.xhtml).

What I need to do on those pages:

  • change some specific text in the page;
  • adjust the zoom level.

I’ve tried declaring a content script with matches: [“<all_urls>”], but it does not seem to be injected into pages using resource:// or chrome://. From what I understand, standard WebExtensions are generally not allowed to run content scripts on privileged/internal pages.

My questions are:

1. In GeckoView on Android, is there any supported way for a WebExtension to inject scripts into chrome:// or about:xxx pages?

2. If WebExtensions cannot do this, are there any other approaches? For example, can I achieve it by operating on GeckoView directly, such as using GeckoSession/GeckoRuntime APIs? If yes, which APIs or mechanisms should I use?

3. Can the zoom level of these internal pages be changed from a WebExtension or from the embedding app? If so, which API should be used? For example, is browser.tabs.setZoom supported for such pages, or should I use a GeckoView API such as setZoomFactor?

4. If this is not supported by design, what is the recommended alternative?

Any documentation, examples, or advice would be greatly appreciated. If this is not supported by design, please let me know what the recommended alternative is.

Thank you!

Hi, and thanks for reaching out!

I’m not a domain expert and don’t have experience with Android development, but I reviewed the documentation to see what I could find. Here’s what I found, so please take it as a starting point rather than a definitive answer.

1. Content scripts on internal pages

This is blocked by design. The MDN page on content scripts says extensions can’t inject into privileged browser pages, such as about: pages, reader view, or view-source:

“<all_urls>” also only matches http, https, ws, wss, ftp, data, and file, so chrome:// and resource:// pages will never match:

On top of that, Firefox applies a strict Content Security Policy to its about: pages that only allows scripts shipped with the browser itself. This post from the security team explains why:

The GeckoView guide for extensions covers built-in extensions and messaging with web content, but I couldn’t find anything that lifts this restriction for internal pages:

2. Doing it through GeckoView directly

I couldn’t find a GeckoSession or GeckoRuntime API for scripting or editing Gecko’s own internal pages. The GeckoView automation guide notes that features without a GeckoView API generally aren’t intended for broad use and are configured through preferences, environment variables, or a config file instead:

3. Zoom

According to MDN’s compatibility data, browser.tabs.setZoom isn’t supported on Firefox for Android:

On the GeckoView side, GeckoRuntimeSettings.setFontSizeFactor works as a global text zoom (it scales font sizes, not the whole page), and changes only apply after the session reloads. I couldn’t confirm whether it affects internal pages:

4. Recommended alternative

If the goal is to give users a friendlier view of settings like those in about:config, the most robust path seems to be building that screen natively in your app and applying the preferences through GeckoView, rather than modifying Gecko’s own pages.

For a definitive answer, you can ask the GeckoView team over at #geckoview at Matrix :

I hope this is somewhat helpful.

-Christos