How to inject scripts in the new tab page or similar pages?

The <all_urls> match pattern is only matching http, ftp and similar protocols, so my question is how to inject a script into the “local” pages like the new tab page.

You cannot with WebExtensions as far as I know. You can replace the about:home and about:newtab but you cannot touch the other about pages.

You can inject in the current tab with “tabs” and “activeTab” permissions but it works only for web sites and other pages that are not Firefox internal stuff.

Sad to hear that, but thank you for your answer.

I’m quite happy about it. I don’t think addons should mess around with browser internals.

1 Like

I really do not understand why an addon developer should even be limited. Of course, they can mess up things, but this will always be the case and is part of any software.

Why would you need to inject something in the new tab page?

This new tab page will be removed soon and will be replaced with Activity stream. If you want to add a feature there, then you can ask for a feature and implement it yourself.

Its more about adding functionality to the overall tab container than to the new tab page, even though I could think about other reasons. My goal is to emulate the firegestures addon which is likely going to die with the upcoming firefox versions. So I’m injecting a little script in every page which does detect and draw the gestures. However it is not consistent due to about pages or other special documents. Especially in times of webextensions, such limitations destroy possible workarounds, rather than being useful.