Skip to content

window.performance.navigation

window.performance.navigation is a legacy interface within the window.performance API that provides information about the type of navigation that led to the current page load^[600-developer__tools__front-end-performance-monitoring.md]. It is frequently used in conjunction with window.performance.timing to calculate page load metrics^[600-developer__tools__front-end-performance-monitoring.md].

Properties

The window.performance.navigation object contains read-only properties that describe the navigation context:

redirectCount

Returns an integer representing the number of redirects since the last non-redirect navigation, if any^[600-developer__tools__front-end-performance-monitoring.md].

Usage in Performance Calculation

When calculating web performance metrics, window.performance.navigation is typically accessed alongside window.performance.timing^[600-developer__tools__front-end-performance-monitoring.md].

To accurately capture these values, data collection usually occurs within the window.onload event^[600-developer__tools__front-end-performance-monitoring.md].

Redirect Count:

var navigation = window.performance && window.performance.navigation;
var redirectCount = navigation && navigation.redirectCount;

Sources