Chrome extension to redirect tab to my page

后端 未结 3 971
醉话见心
醉话见心 2021-01-01 06:40

I am new to chrome extensions and I am having trouble while writing my first extension for chrome. What I am trying to do is detect the new tab action and redirect to a pre-

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-01 07:23

    Add this guy to your manifest.json file.

    "chrome_url_overrides": {
          "newtab": "index.html"
       }
    

    with index.html being replaced with your page. This will make it so it will show index.html when you open a new tab instead of the default.

    I have an extension that basically does the same thing. Here's my manifest.json that you can use as a reference.

    {
      "name": "appName",
      "version": "0.1",
      "manifest_version": 2,
      "chrome_url_overrides": {
          "newtab": "index.html"
       },
    
      "description": "Desc Here",
      "icons": {
        // "128": "icon128.png"
      },
      "content_scripts": [ {
      "css": ["css/styles.css"],
      "js": [ ],
      "matches": [ "*://*/*" ],
      "run_at": "document_start"
      } ],
      "minimum_chrome_version": "18",
      "permissions": [ "http://*/*", "https://*/*", "cookies", "tabs", "notifications" ]
    
    }
    

提交回复
热议问题