I counted them in the HTML Source and in the DOM running the script below in the console for each website.
The number of external Javascript files is from the Console > Network > JS
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() { | |
function getSource(url, callback) { | |
var xhr = new XMLHttpRequest(); | |
xhr.onreadystatechange = function() { | |
if (xhr.readyState === XMLHttpRequest.DONE) { | |
return callback(xhr.responseText); | |
} | |
}; | |
xhr.open('GET', url, true); | |
xhr.send(null); | |
} | |
function countScripts(p) { | |
var count = (p.match(/<script/g) || []).length; | |
return (count); | |
} | |
var url = document.location.href; | |
getSource(url, function(source) { | |
console.log(url + "\n\tScripts in source: " + countScripts(source) + "\n\tScripts in DOM: " + document.getElementsByTagName("script").length); | |
}); | |
})(); |
No comments :
Post a Comment