Get list of links on page


I would like to gather/output the links on a page.

could i use jquery and something like links: $(a:not([rel=nofollow])


I ended up doing this:

        var linksOnPage = "";
        var links = document.getElementsByTagName("a");
        for (var i = 0; i < links.length; i++) {
            if (links[i].href.length > 2) {
                linksOnPage += (links[i].href) + "\n";

            links: linksOnPage


Hello @Barry_Schneider,

That’s great that you figured that out. You can of course use jQuery too by first selecting the “inject jQuery” option and then grabbing it off context, typically like this var $ = context.jQuery and then getting all the <a href="..."> elements with $('a[href]').