NavigationDestination: thuộc tính id

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 id của giao diện NavigationDestination trả về giá trị id của NavigationHistoryEntry đích nếu NavigateEvent.navigationTypetraverse, hoặc một chuỗi rỗng nếu không.

id là một giá trị duy nhất do UA tạo ra, luôn đại diện cho mục lịch sử, hữu ích để liên kết một mục lịch sử với một tài nguyên bên ngoài như bộ đệm lưu trữ.

Giá trị

Một chuỗi đại diện cho id của NavigationHistoryEntry đích, hoặc một chuỗi rỗng.

Ví dụ

js
navigation.addEventListener("navigate", (event) => {
  console.log(event.destination.id);
});

Thông số kỹ thuật

Thông số kỹ thuật
HTML
# the-navigationdestination-interface:dom-navigationdestination-id-2

Tương thích trình duyệt

Xem thêm