Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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