How to get all the URLs in a web site using JavaScript?

前端 未结 4 2118
借酒劲吻你
借酒劲吻你 2021-01-02 17:50

Any one knows a way to get all the URLs in a website using JavaScript?

I only need the links starting with the same domain name.no need to consider other links.

4条回答
  •  长发绾君心
    2021-01-02 18:11

    using jquery u can find all the links on the page that match a specific criteria

    $("a[href=^domain.com]").each(function(){
          alert($(this).attr("href"));
    });
    

提交回复
热议问题