I am writing a script to get info from all links on the page and display it. It works fine, but I get an Out Of Memory error, even though the script still does its job.
Heres the script:
<a href=”http://google.com”>Google</a>
<script language=”javascript”>
function getLinks(number)
{
var max = document.links.length;
var number = number;
var links = new Array()
if (number < max)
{document.write(“<pre>” + number + ” ” + document.links[number] + ” ” +document.links[number].innerText + “<br>” + “</pre>”)}
else{};
getLinks(number+1)
}
getLinks(0)
</script>
I just need to fix this and add the link’s protocol to the list…then I think I will make a bookmarklet out of this and it will be pretty cool ?
Any help is appreciated…