Chrome扩展程序:如何在新标签页中显示背景图片 [英] Chrome Extension:How to show background image in new Tab
问题描述
我愿意拥有与流行的扩展程序(例如Moments或Limitless)类似的功能,这些功能可以显示精美的壁纸.
I am willing to have a similar functionality like given in popular extensions like Moments or Limitless which show beautiful wallpaper.
我该如何实施?另外,如果安装了多个在新标签页上显示图片的类似扩展程序,是否可以让chrome首先在标签页上显示我的图片?
How can I implement it? Also, if multiple similar extensions are installed who shows image on new tab, is there way to let chrome show my image in tab first?
谢谢
推荐答案
可以通过在 manifest.json
的 chrome_url_overrides
属性中指示其他新的标签页来实现:
This is possible by indicating a different new tab page in the chrome_url_overrides
property in the manifest.json
:
{
"name": "My extension",
"chrome_url_overrides" : {
"newtab": "myNewTabPage.html"
}
}
然后,您可以使用所需的背景图像修改 myNewTabPage.html
,并附加必要的样式表和资产.
Then you can modify the myNewTabPage.html
with background image you need, attaching the necessary stylesheets and assets.
在此处检查有关覆盖的更多详细信息.
Check here more details about overrides.
如果已安装多个类似的扩展程序,新标签页替代将由Chrome上安装的最新扩展程序管理,并且此行为无法更改.
If multiple similar extensions are installed The new tab override will be managed by the latest extension installed on Chrome and this behavior cannot be changed.
这篇关于Chrome扩展程序:如何在新标签页中显示背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!