Last active
September 14, 2016 22:19
-
-
Save cvazac/1498565ca958f6d67f82e1c5360ca631 to your computer and use it in GitHub Desktop.
This file contains 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(w) { | |
if (w != top) return | |
w.addEventListener('load', function() { | |
var iframe = document.createElement('iframe') | |
iframe.style.display = 'none' | |
iframe.src = location.href | |
document.body.appendChild(iframe) | |
iframe.addEventListener('load', function() { | |
var outer = w.performance | |
var inner = arguments[0].target.contentWindow.performance | |
outer.getEntriesByType('resource').forEach(function(resource) { | |
var found = inner.getEntriesByName(resource.name, 'resource') | |
if (found && found.length != 0) { | |
if (found[0].duration > (resource.duration / 10)) | |
console.info(resource, resource.name, resource.duration, found[0].duration) | |
} | |
}) | |
iframe.parentNode.removeChild(iframe) | |
}) | |
}) | |
})(window) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment