简体   繁体   中英

How to make content scripts match new tabs in firefox addons/extensions?

I know normally you just set the URL next to matches like - "matches": ["<all_urls>"], but I could not find any documentation of what the URL is for new tabs in firefox, I could only find that URL for chrome.

Heres my manifest.json -

{
  "manifest_version": 2,
  "name": "TestExt1",
  "version": "1.0",

  "icons": {
    "48": "icons/icon1.png"
    },

  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["TestExt1.js"]
    }
  ]

}

I read another post on here about making a button opening a new tab using "_blank", so I tried setting my matches to "matches": ["_blank"], in the manifest file but that did not work. I have confirmed my issue is not with the javascript file because it works on every other URL.

How can I set my scripts to only make changes to new tabs?

Or is this something I have to make happen within the content script files themselves?

the default new tab page with the tiles is about:newtab

the default home page is about:home

for a blank page use about:blank

See the about:about page for available about pages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM