get all the URLs in a web site using javascript -
any 1 knows way urls in website using javascript?i need links starting same domain name.no need consider other links
well same-host links on page:
var urls= []; (var i= document.links.length; i-->0;)     if (document.links[i].hostname===location.hostname)         urls.push(document.links[i].href);   if site mean want recursively links inside linked pages, that's bit trickier. you'd have download each link new document (for example in <iframe>), , onload check iframe's own document more links add list fetch. you'd need keep lookup of urls you'd spidered avoid fetching same document twice. wouldn't fast.
Comments
Post a Comment