files/en-us/web/api/navigationdestination/key/index.md
{{APIRef("Navigation API")}}
The key read-only property of the
{{domxref("NavigationDestination")}} interface returns the {{domxref("NavigationHistoryEntry.key", "key")}} value of the destination {{domxref("NavigationHistoryEntry")}} if the {{domxref("NavigateEvent.navigationType")}} is traverse, or an empty string otherwise.
The key is a unique, UA-generated value that represents the history entry's slot in the history entries list, used to navigate to this place in the history via {{domxref("Navigation.traverseTo()")}}. It will be reused by other entries that replace the entry in the list (i.e., if the {{domxref("NavigateEvent.navigationType")}} is replace).
A string representing the key of the destination {{domxref("NavigationHistoryEntry")}}, or an empty string.
navigation.addEventListener("navigate", (event) => {
console.log(event.destination.key);
});
{{Specifications}}
{{Compat}}