HOW TO programmatically access all links on a web page

If you have to download files all files whose links are listed on a web page, this scripted method can accomplish the task faster (after some customization to the specific context) from the console tab of the Developer Tools feature of popular browsers -

Array.prototype.forEach.call(
    document.querySelectorAll("a.download[href*=x64]"),
    function (a) {
        console.log("wget " + a.href);
    });

With jQuery, it's even more terser -

$("a.download[href*=x64]").each(function () {
    console.log("wget " + this.href);
});

Comments

Popular posts from this blog

Uncle Bob vs. Grady Booch: Rethinking Code Reviews in the Age of AI

10 Tips to Avoid Claude Usage Limits

This Week I Learned - Week 14 2026