Is there a tool to get a list of links on a web page?

I want a list of links on some pages.  It would love to have a two column list with the link name on the left & the actual URL on the right, but a plain text list of link names would do.  

How could I get this without editing the page itself?
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.

Michel PlungjanIT ExpertCommented:
I could write you a bookmarklet if you want
A link on the link bar you can click to get the list you want.
Would that be what you were thinking about?
Michel PlungjanIT ExpertCommented:
Or is this on your page?


window.onload=function() {
  var links = document.links;
  var html = "<table>";
  for (var i=0,n=links.length;i<n;i++) {
    if (links[i].href!="") html += '<tr><td>'+
  html +='</table>';
  var linksDiv = document.createElemen('div');'250px';'scroll';

Open in new window

leslieinvaAuthor Commented:
Hi mplungjan,

How do I turn your script into a bookmarklet?
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

Michel PlungjanIT ExpertCommented:
and the last } to
leslieinvaAuthor Commented:
After I do that, then how do I add it to my links bar?

I made the changes you suggested, then removed all the line breakes and pasted it into the URL for a bookmark.  I get no response from clicking on the bookmark.
Michel PlungjanIT ExpertCommented:
Sorry, forgot the double quotes and to add the innerHTML

Drag the link in the bottom right field off to the links bar

And here is the code

<a href="javascript:(function() {var links = document.links;var html = '<table>';for (var i=0,n=links.length;i<n;i++) { if (links[i].href!='') html += '<tr><td>'+links[i].textContent+'</td><td>'+links[i].href+'</td></tr>';} html +='</table>';var linksDiv = document.createElement('div');'250px';'500px';'absolute';'0';;'scroll';linksDiv.innerHTML=html;document.body.insertBefore(linksDiv,document.body.firstChild);

Open in new window

leslieinvaAuthor Commented:
This is almost exactly what I need!  The only problem is how do I get this info off the screen into a text format of any kind?  I can't read it with the transparent background or use the info anywhere else as it displays now.

Can you have it create a separate HTML file, like the "Search Links" bookmarklet does at
Michel PlungjanIT ExpertCommented:
1) add'white';
to get rid of the transparency

var linksDiv = document.createElement('div');'250px';'500px';'absolute';'0';;'scroll';linksDiv.innerHTML=html;document.body.insertBefore(linksDiv,document.body.firstChild);
var'','_blank');if (w) {w.document.write(html);w.document.close()}

to get all the links in a new window

Right now the table will take on the CSS of the parent page

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
leslieinvaAuthor Commented:

Many Thanks!!  

I'll give you more points if you can make the URL texts into real links in the output that open the linked pages into a new tab.
Michel PlungjanIT ExpertCommented:
You are welcome

With the points from this question I hit Overall Expert Point Total: 10,000,866
Giving me Savant Status.

jsFiddle with both bookmarklets

<a href="javascript:(function() {var links = document.links;var html = '<table>';for (var i=0,n=links.length;i<n;i++) { if (links[i].href!='') html += '<tr><td><a href=\''+links[i].href+'\'>'+links[i].textContent+'</a></td><td>'+links[i].href+'</td></tr>';} html +='</table>';var'','_blank');if (w) {w.document.write(html);w.document.close()}

Open in new window

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.