Skip to content

Instantly share code, notes, and snippets.

@cvazac
Last active November 28, 2017 03:41
Show Gist options
  • Select an option

  • Save cvazac/a3660db0f103d76bc23da848a5899396 to your computer and use it in GitHub Desktop.

Select an option

Save cvazac/a3660db0f103d76bc23da848a5899396 to your computer and use it in GitHub Desktop.
Heuristic to identify resources that were cached in the browser
function cachedInBrowser(resourceTimingEntry) {
if (resourceTimingEntry.requestStart) {
// has permissive Timing-Allow-Origin response header
return resourceTimingEntry.transferSize === 0
}
// because.... physics?
return resourceTimingEntry.duration < 30
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment