identity.getRedirectURL()

生成一个可用作重定向 URL 的 URL。

这一 URL 将派生自你的扩展 ID,因此如果你使用此函数,你应该使用 browser_specific_settings 键显式设置扩展的 ID(否则每次你临时安装扩展时都会得到不同的重定向 URL)。

参见获取重定向 URL 一节以获取更多关于重定向 URL 的信息。

语法

js
let redirectURL = browser.identity.getRedirectURL()

参数

无。

返回值

包含重定向 URL 值的字符串。

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
getRedirectURL

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

示例

获取重定向 URL:

js
let redirectURL = browser.identity.getRedirectURL();

示例扩展

备注: 该 API 基于 Chromium 的 identity API。