Get all links of a webpage with bookmarklet

Hello friends. Want to get all the links of a webpage. Here you are at right place. A simple javascript bookmarklet can do this stuff.

You only have to follow these simple steps.

1. Create an Html file with following code.
2. Run this file and create a bookmarklet.
3. Open the webpage which you want to get the links.
4. Just click your bookmarklet.

You will see all the links of that webpage displayed infront of you.

Thats it. Thanks !!

  <a href='javascript:loc=location.href;
  title=document.title;
  x=document.getElementsByTagName("A");
  
  y=window.open();
  y.document.write("<html><body><h3>Links: "+loc+"</h3>\n");
  
  for(n=0;n<x.length;n++){
  
  if(x[n].href!=""){
        if(x[n].text.replace(/\s+/,"").length<1){
           for(j=0;j<x[n].childNodes.length;j++) {
            if(x[n].childNodes[j].nodeName=="IMG"){
             y.document.write(""); break;
             }
           }
        }else{
             y.document.write(" "+x[n].href+"<br>"); 
             }
    }
  }
  y.document.write("</body></html>");
  y.document.close();void(0);'>Get Links</a>

Get all links of a webpage with bookmarklet Get all links of a webpage with bookmarklet Reviewed by JS Pixels on December 03, 2011 Rating: 5

No comments:

Altaf Web. Powered by Blogger.