Get resources that website is using

The easiest way to get a list of the pathes to all resources (scripts and stylesheets) the website has loaded.


Libraries

Code Snippet
function getResources() {
    return Array.from(document.querySelectorAll("script[src], link[rel=stylesheet][href]")).map(element => element.src || element.href);
}


Implementation

You can also remove [rel=stylesheet] if you’re also interested in fav-icons and other resources.





Comments
  • mode_editWrite a comment



  • forumComments




Embed Code

We provide special containers which include the full snippet and a link to this site. So for example when you make a tutorial and you are using code from this site, you can use one of the following snippet embeddings:

Load Preview Get Code Close Preview







    Share
    Rating
    thumb_up 0 thumb_down
    Author
    Thorolus

    I'm the head developer and co-founder of GlovilGames Studios (glovilgames.com) and other platforms GlovilGames created, like vsnippets.com, worth-calculator.net, python-obfuscator.com and some mobile apps and games.

    Tags
    Basics



    Informations

    posted on 2016-10-02 17:39:02

    viewed 641 times

    snippet's UUID is 57f12a1690986

    Similar Snippets