How to extract the hyper links from a webpage in javascript

window.onload = function() {
document.onclick = function(e) {
    var target = e.srcElement;
    if (target != null) {
         var href = target.href;
         if (href != null) {
             alert("link extracted: " + href);
         }
    }
    return false;
};
}

Leave a Comment