Get all URl's in a page to a fil.


Get all URl's in a page to a fil.
I want help with a script ot a tool that can check a specific page thats open and gets all links to a txt file.

LVL 11
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

document.getElementsByTagName("a") will get all the links
bsharathAuthor Commented:
can you give me the whole script vbs or batch

<a href="file1.txt">link 1</a>
<a href="file2.txt">link 2</a>

<textarea id='txt' cols="100" rows="10">

<script language="javascript">
	var txt = document.getElementById('txt');
	txt.value = '';
	var hrefs = document.getElementsByTagName("a");
	for(i = 0; i < hrefs.length; i++) {
		txt.value += hrefs[i].href + "\r\n";

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

bsharathAuthor Commented:
can you tell me how do i run thi?
Link where should i mention the link and is this vbs?
you just write the code at the end of the HTML you want to take the links out
it is not VB, it is JavaScript
bsharathAuthor Commented:
You mean if i need to take all links of this current page. save the view source code into html and then take your code and place it at the end and open the html and it will save the txt file?
where do you want to take the links from ?
bsharathAuthor Commented:
I have a page where there are many URL's

I mean some titles have these URL's within them
So need to query that particular page and get the URL's

So its better if we query the IE or FF page thats opened and gets the URL's to a txt file
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.