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
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
using jquery u can find all the links on the page that match a specific criteria
Well this will get all the same-host links on the page:
If by site you mean you want to recursively get the links inside linked pages, that's a bit trickier. You'd have to download each link into a new document (for example in an
<iframe>
), and theonload
check the iframe's own document for more links to add to the list to fetch. You'd need to keep a lookup of what URLs you'd already spidered to avoid fetching the same document twice. It probably wouldn't be very fast.