Chapter 7. Scripting Preconditions

Chapters 5 and 6 focused on different ways to configure WebPageTest to more accurately represent how real users access a page. We considered the browser, connection speed, geographic location, and device type as customizable options. One thing that has been relatively unmentioned so far is the state of the page and how that can have an effect on its performance.

The cache state of a page has been discussed earlier, but as noted in “Enabling Repeat View”, we cannot simply rely on the repeat view to represent the cache state of a page. This view is useful for illustrating the resources that could benefit from client-side persistence through the narrow perspective of reloading a page to see what still needs to be downloaded. Realistically, however, users don’t just visit a page and reload it. There are other vectors in which a page could be warmed up with the user’s prior browsing history.

Two examples of this would be caching of resources both internal and external to the site. Resources can be shared between pages of the same site, such as a common stylesheet or masthead logo. Going from one page to another doesn’t usually require that these resources be downloaded again. External resources can also be shared between pages on different sites. Third-party resources like CDN-hosted JavaScript libraries may already be cached on a user’s machine before the user ever visits a page that requires that resource. When the user visits such a page for the ...

Get Using WebPageTest now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.