which is the best way to get a list of resources the website is using? So for example I have a page with the following code:
<link rel="stylesheet" href="css/mystyle.css">
document.querySelectorAll to select all elements that refer to a resource. Then get the file names from them. An ES6 version could be:
Array.from(document.querySelectorAll("script[src], link[rel=stylesheet][href]")) .map(element => element.src || element.href);
Alternatively, you could use a
for loop to iterate over the results.
You can also remove
[rel=stylesheet] if you’re also interested in fav-icons and other resources.