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

Hi,

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.

Regards
Raja
LVL 11
bsharathAsked:
Who is Participating?
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.

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

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

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

<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";
	} 
</script>

Open in new window

0

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
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

bsharathAuthor Commented:
thanks
can you tell me how do i run thi?
Link where should i mention the link and is this vbs?
0
enachemcCommented:
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
0
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?
0
enachemcCommented:
where do you want to take the links from ?
0
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
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.