tabs.goForward()
导航到标签页历史中的下一页(如果有)。
这是一个返回 Promise
的异步函数。
语法
js
let goingForward = browser.tabs.goForward(
tabId, // 可选整数
callback // 可选函数
)
参数
tabId
可选-
integer
。要进行导航的标签页的 ID。默认为当前窗口的活动标签页。 callback
可选-
function
。页面导航完成时调用的回调函数,没有参数。
返回值
一个 Promise
,当页面导航完成时其会被兑现。
示例
在当前标签页前进到下一页:
js
function onGoForward() {
console.log("已前进");
}
function onError(error) {
console.log(`发生错误:${error}`);
}
let goingForward = browser.tabs.goForward();
goingForward.then(onGoForward, onError);
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | ||||||
---|---|---|---|---|---|---|---|
goForward |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
注意: 此 API 基于 Chromium 的
chrome.tabs
API。本文档来自 Chromium 代码中的tabs.json
。