A bit of a newbie question but what is the best way to get a list with full name path of all JS files loaded on my website?
To clarify: I have a page www.mypage.com - I want to get a list of all the JS files with their full name paths which are loaded on this page.
You can also use the Performance API:
var entries = performance.getEntriesByType('resource');
entries.map(function(entry) {
if (entry.initiatorType === 'script') {
console.log('JS file:', entry.name);
}
});
You should get all the script tags first::
var scripts = document.getElementsByTagName('script');
And then loop through it:
for(var i=0;i<scripts.length;i++){
scripts[i].src;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With