From the course: Vanilla JavaScript: Web Performance Optimization APIs

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add the Navigation Timing API

Add the Navigation Timing API - JavaScript Tutorial

From the course: Vanilla JavaScript: Web Performance Optimization APIs

Start my 1-month free trial

Add the Navigation Timing API

- [Narrator] Continuing with the project, it's time to replace our on-low handler here with the navigation time in API we're going to start using navigation time in API version 2 and then we will make a fall back. So for that, we need tracks their performance object and there, we need to get entries. In this case, by type. We're going to ask for, the type navigation we don't have frames here, so we don't need to add for frame And that will give us a list of entries, so let's create navigation entries. Let's create the constant for that, and then we're going to take those entries, and make a loop. So we're going to check every entry, and for every entry there, we're going to do something. In this case, there is only one entry usually for navigation, or no entries at all. So I can show access sub zero if tail for each and just in case let's other for each. And if it's zero, it's probably because it doesn't have the second version of the API. So once we are here, what we're going to do…

Contents