Navigation: thuộc tính canGoForward
Baseline
2026
Newly available
Since January 2026, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Thuộc tính chỉ đọc canGoForward của
giao diện Navigation trả về true nếu có thể điều hướng tiến trong lịch sử điều hướng
(tức là currentEntry không phải là mục cuối cùng trong danh sách mục lịch sử),
và false nếu không thể.
Giá trị
Giá trị boolean: true nếu có thể điều hướng tiến trong lịch sử điều hướng, false trong trường hợp ngược lại.
Ví dụ
js
async function backHandler() {
if (navigation.canGoBack) {
await navigation.back().finished;
// Handle any required clean-up after
// navigation has finished
} else {
displayBanner("You are on the first page");
}
}
async function forwardHandler() {
if (navigation.canGoForward) {
await navigation.forward().finished;
// Handle any required clean-up after
// navigation has finished
} else {
displayBanner("You are on the last page");
}
}
Thông số kỹ thuật
| Specification |
|---|
| HTML> # dom-navigation-cangoforward-dev> |