Hilfe durchsuchen

Vorsicht vor Support-Betrug: Wir fordern Sie niemals auf, eine Telefonnummer anzurufen, eine SMS an eine Telefonnummer zu senden oder persönliche Daten preiszugeben. Bitte melden Sie verdächtige Aktivitäten über die Funktion „Missbrauch melden“.

Learn More

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

  • 3 Antworten
  • 1 hat dieses Problem
  • 180 Aufrufe
  • Letzte Antwort von 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.

Ausgewählte Lösung

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.

Diese Antwort im Kontext lesen 👍 1

Alle Antworten (3)

more options

Ausgewählte Lösung

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.

Geändert am von specialx1

more options

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

2)