Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Cuireadh an snáithe seo sa chartlann. Cuir ceist nua má tá cabhair uait.

How to run JS code through extension at about:home page?

  • 3 fhreagra
  • 1 leis an bhfadhb seo
  • 180 views
  • Freagra is déanaí ó cor-el

more options

I tried:

"content_scripts": [

       {
           "matches": [
               "about:home" 
           ],
           "js": [
               "main.js"
           ]
       }

But it doesn't work. And about:newtab also doesn't work

I know that I can do chrome_url_overrides, to replace newtab with my own page, but I really wanted to run my JS code on existing inbuilt homepage.

I know that I can run my own CSS via userContent.css, but how do I run my own JS?

Can I even run scripts at about:newtab? Maybe its not supported through api, since https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns doesn't show any example of accessing it. If so, where is about:newtab HTML file located? Maybe I could inject my code through file, without making extesion.

I tried: "content_scripts": [ { "matches": [ "about:home" ], "js": [ "main.js" ] } But it doesn't work. And about:newtab also doesn't work I know that I can do chrome_url_overrides, to replace newtab with my own page, but I really wanted to run my JS code on existing inbuilt homepage. I know that I can run my own CSS via userContent.css, but how do I run my own JS? Can I even run scripts at about:newtab? Maybe its not supported through api, since https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns doesn't show any example of accessing it. If so, where is about:newtab HTML file located? Maybe I could inject my code through file, without making extesion.

Réiteach roghnaithe

That is not possible, extensions do not work on about pages and other special pages and on Mozilla websites and some others and can't inject files.

A JavaScript bookmarklet probably works just like running code in the Web Console.

Read this answer in context 👍 1

All Replies (3)

more options

Réiteach Roghnaithe

That is not possible, extensions do not work on about pages and other special pages and on Mozilla websites and some others and can't inject files.

A JavaScript bookmarklet probably works just like running code in the Web Console.

more options

cor-el said

That is not possible, extensions do not work on about pages and other special pages and on Mozilla websites and some others and can't inject files. A JavaScript bookmarklet probably works just like running code in the Web Console.

Firstly, thanks for that quick response, it really clarified things for me. So code in this (https://support.mozilla.org/en-US/questions/1316166) question also won't work because of that.

I have two more questions before I mark this as solved. 1. Where HTML file of about:home is located? I was looking through mozilla files but couldn't find it. Is it compilled to some .dll file or something like that? 2. Where in firefox documentation I can find that extensions do not work on about pages and other special pages and on Mozilla websites and some others? It's not that I doubt your answer, it's just it would be helpful for me to know where to look for those informations.

Athraithe ag specialx1 ar

more options

1) The about:home and about:newtab pages are generated via JavaScript, so there is no real (x)html file.

2)