Script to automatically bookmark the links on a page

2.5k Views Asked by At

I want to bookmark all the links present on a site into a new bookmarks folder. Is there any script to do that? Example: From the Wikipedia page containing a list of American Scientists (http://en.wikipedia.org/wiki/List_of_American_scientists), I want to bookmark each and every link containing the scientist names into a new folder named "American Scientists".

Thanks!

1

There are 1 best solutions below

0
On

You should look into creating an extension for chrome or firefox.

You can then use javascript/jquery to get all of the links in the DOM and add them:

$html.find('a').each(function(){
    bookmark($(this).attr("title"), $(this).attr("href"));
});

function bookmark(title, href) {
    if (window.sidebar && window.sidebar.addPanel) { // Mozilla Firefox Bookmark
        window.sidebar.addPanel(title,href,'');
    } else if(window.external && ('AddFavorite' in window.external)) { // IE Favorite
        window.external.AddFavorite(href,title); 
    } else if(window.opera && window.print) { // Opera Hotlist
        this.title=title;
        return true;
    } else { // webkit - safari/chrome
        alert('Press ' + (navigator.userAgent.toLowerCase().indexOf('mac') != - 1 ? 'Command/Cmd'    :       'CTRL') + ' + D to bookmark this page.');
        }
    }

Bookmark function was taken from here: Bookmark Javascript not jquery for website