BookmarkArchiver allows you to easily archive all of your bookmarks using archive.org.
I frequently forget solutions to problems I have when programming, so I bookmark the website with the answer so I can refer to it later. The problem with that arises when a site goes down or a user deletes their question.
To resolve this I’ve started using archive.org so I can always access the answers even if the page no longer exists.
I’ve created a Chrome extension for the task of archiving every single one of my bookmarks with a single click.
The basic functionality is quite simple, all you need to do is push the right page to archive.org.
function archive(url) {
var request = new XMLHttpRequest();
request.open('GET', "https://web.archive.org/save/" + url);
request.send();
request.onreadystatechange = function(event) {
var xhr = event.target;
if (xhr.readyState === 4 && xhr.status === 200) {
appendResult("<b>Archived</b><br>" + "<a href='https://web.archive.org/web/*/" + url + "'target='_blank' rel='noreferrer'>" + url + "</a>");
} else if (xhr.readyState === 4) {
appendResult("<b>Error archiving</b>\n" + url);
}
};
}
Then get all the bookmarks and execute the archive function on them.
function archiveBookmark(bookmarks) {
bookmarks.forEach(function(bookmark) {
if (bookmark.url) {
archive(bookmark.url);
if (saveIsChecked()) {
createBookmark(bookmark.title, bookmark.url);
}
}
if (bookmark.children) {
archiveBookmark(bookmark.children);
}
});
}
The extension is very much still a work in progress.
I’m planning on adding a feature that allows saving result URLs to a new bookmark folder so you can easily view the history of your archived bookmarks. I’m also planning on adding a feature that adds an option to automatically archive new bookmarks.
The code is avaliable on Github.
You can also install the extension right from the Chrome Webstore.