Fri, 17 May 2024


How to get all the links on a HTML page with JavaScript?

By: Peter, NetArt Media
Wed, 26 August 2020

Try the following (see example below) script by putting it on page where there are at least one hyperlink (for example <ahref="http://zamov.online.fr">zamov.online.fr</a> )

<script>

for (i=0; i < document.links.length; i++)

{

alert(document.links[i].href);

}

</script>


Category: Javascript
Share this post:



See All Scripts






Subscribe for our newsletter

Receive the latest blog posts direct in your mailbox