[英]Firefox JS Extension | How do I access the new tab and the homepage of Firefox to inject my new page?
我一直在关注许多Firefox插件/扩展示例,并搜索了“tab”文档; 但是,我仍然没有找到如何使用我新创建的index.html页面作为Firefox的新选项卡或主页。
我想创造像Momentum这样的东西。 适用于Firefox的个人仪表板。
这就是我现在所拥有的。 但是,因为我在tabs.onCreated
上创建了一个新选项卡,所以我在新选项卡中创建了一个无限循环。
的manifest.json
{
"description": "Adds browser action icon to toolbar to open packaged web page. See https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Examples#open-my-page-button",
"manifest_version": 2,
"name": "Bookify",
"version": "1.0.0",
"homepage_url": "https://github.com/mdn/webextensions-examples/tree/master/open-my-page-button",
"icons": {
"48": "icons/border-48.png"
},
"background": {
"scripts": ["background.js"]
},
"browser_action": {
"default_icon": "icons/border-48.png"
},
"web_accessible_resources": [
"images/*.jpg",
"videos/*.mp4"
]
}
Background.js
function openMyPage() {
browser.tabs.create({
"url": "/dash.html"
});
}
browser.tabs.onCreated.addListener(openMyPage);
感谢Ramkumar KR对这个问题的回答,我在manifest.json中实现了以下内容:
"chrome_url_overrides" : {
"newtab": "index.html"
}
因此,如果有人想知道如何更改Firefox中的newtab页面,请使用chrome_url_overrides 。 由于提到的问题尚未正式“回答”,我将留下这个问题并自己回答,以便其他开发人员可以在这里找到他们的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.