When Is redirectStart populated in NavigationTiming object?

250 Views Asked by At

I'm using the NavigationTiming object to monitor performance of my website.

According to the W3C document on the redirectStart property of the NavigationTiming object:

If there are HTTP redirects or equivalent when navigating and if all the redirects or equivalent are from the same origin, this attribute must return the starting time of the fetch that initiates the redirect.

My site currently has a login page, which submits POST and receives a 302 redirect to a welcome page. I expected the NavigationTiming object on the welcome page to include the redirectStart and redirectEnd properties to be populated, but they are 0.

When should they be populated, if not then?

1

There are 1 best solutions below

0
On

Are the login page and welcome pages different origins, for example, different schemes (HTTP/HTTPS) or servers (foo.com vs www.foo.com)?

NavigationTiming will zero-out the redirectStart and redirectEnd attributes if the origin differs between the two addresses in any way.

(Note the POST method is not part of the origin calculation and thus should not cause the property to zero-out just because it's a POST 302 to a GET)

If you care to share your site I could investigate further.

You can also verify your browser properly supports the redirect case by running the W3C test cases here.