Google Chrome扩展程序默认位于新标签中

时间:2016-06-23 19:37:29

标签: google-chrome-extension

因此我尝试制作Google Chrome扩展程序,并且我希望它在您打开新标签时打开。有点像muz.li.基本上,当您按ctrl + t打开新标签而不是显示谷歌时,它会显示我的扩展名。

谢谢!

2 个答案:

答案 0 :(得分:2)

在打开新标签页时,只需添加以下代码即可打开扩展程序,您不需要背景js或html文件。它位于manifest.json文件中:

"chrome_url_overrides": {
    "newtab": "page.html"
},

答案 1 :(得分:1)

我建议使用chrome.tabs.onCreated事件来检测有人打开新标签页。

https://developer.chrome.com/extensions/tabs#event-onCreated