Last active
November 28, 2017 03:41
-
-
Save cvazac/a3660db0f103d76bc23da848a5899396 to your computer and use it in GitHub Desktop.
Heuristic to identify resources that were cached in the browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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