79416425

Date: 2025-02-05 23:24:28
Score: 0.5
Natty:
Report link

How can you run the script even in blank tabs?

Content scripts do not run in about: pages by default, even with <all_urls> specified. To make content scripts run in about:blank, you must specify it explicitly with match_about_blank.

  ...
  "content_scripts": [ {
    "js": [ "content.js" ],
    "matches": [ "<all_urls>" ],
    "match_about_blank": true
  } ],
  ...

Be aware that the content script cannot be made to run in any other about: page, including about:newtab, which is what new tabs are (not about:blank).

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Starts with a question (0.5): How can you
  • Low reputation (0.5):
Posted by: Nanigashi