The navigationId read-only property of the PerformanceSoftNavigation interface returns an increasing integer id unique to this page load.
An integer unique to this page load.
navigationId of the soft navigationThis example uses a PerformanceObserver to log new soft-navigation performance entries as they are recorded in the browser's performance timeline. The buffered option is used to access entries from before the observer creation.
const observer = new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
console.log("Soft Nav:", entry.startTime, entry.navigationId);
}
});
observer.observe({ type: "soft-navigation", buffered: true });