Created
March 22, 2017 13:42
-
-
Save cagataygurturk/be3bbd3a90a9c3bb8fa1facc6aabd761 to your computer and use it in GitHub Desktop.
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 ($) { | |
var scanInterval = 2000; | |
if(typeof window.performance.getEntriesByType === 'undefined') return; | |
var alreadyLoggedResources = {}; | |
var logHttpResource = function(resourceName) { | |
if(alreadyLoggedResources.hasOwnProperty(resourceName)) { | |
return; | |
} | |
console.log(resourceName + ' - ' + location.href); // LOG HERE | |
alreadyLoggedResources[resourceName] = true; | |
}; | |
var detectHttpResources=function() { | |
$($.grep(window.performance.getEntriesByType("resource"), function(resource){ | |
return resource.name.startsWith('http://'); | |
})).each(function(i, resource){ | |
logHttpResource(resource.name); | |
}); | |
window.setTimeout(detectHttpResources, scanInterval); | |
}; | |
$(document).ready(detectHttpResources); | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment