Skip to content

Instantly share code, notes, and snippets.

@cvazac
Last active Sep 14, 2016
Embed
What would you like to do?
(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