chrome_url_overrides 编辑

TypeObject
MandatoryNo
Example
  "chrome_url_overrides" : {
    "newtab": "my-new-tab.html"
  }

Use the chrome_url_overrides key to provide a custom replacement for the documents loaded into various special pages usually provided by the browser itself.

Syntax

The chrome_url_overrides key is an object that may have the following properties:

NameTypeDescription
bookmarksString

Provide a replacement for the page that shows the bookmarks. 

historyString

Provide a replacement for the page that shows the browsing history. 

newtabString

Provide a replacement for the document that's shown in the "new tab" page. This is the page that's shown when the user has opened a new tab but has not loaded any document into it: for example, by using the Ctrl/Command+T keyboard shortcut.

The replacement is given as a URL to an HTML file. The file must be bundled with the extension: you can't specify a remote URL here. You can specify it relative to the extension's root folder, like: "path/to/newtab.html".

The document can load CSS and JavaScript, just like a normal web page. JavaScript running in the page gets access to the same privileged "browser.*" APIs as the extension's background script.

It's very good practice to include a <title> for the page, or the tab's title will be the "moz-extension://..." URL.

A common use case is to let the user define a new tab page: to do this, provide a custom new tab page that navigates to the page the user defined.

If two or more extensions both define custom new tab pages, then the last one to be installed or enabled gets to use its value.

To override the browser's homepage, use "chrome_settings_overrides" instead.

All properties are localizable.

Example

"chrome_url_overrides" : {
  "newtab": "my-new-tab.html"
}

Browser compatibility

BCD tables only load in the browser

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:150 次

字数:3832

最后编辑:8年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文