I've been trying to figure out how one prints all the values in a specified folder from Google Chrome. Thus far, I've only been able to get it to create a folder with a name of my choice, but I can't access it.
function checkBookmarks() {
var folderName = 'Helium';
chrome.bookmarks.getChildren("1", function(children) {
var numChildren = children.length;
while (numChildren--) {
if (children[numChildren].title == folderName) {
folderId = children[numChildren].id;
break;
}
}
if (folderId === undefined) {
chrome.bookmarks.create({
parentId: "1",
title: folderName
}, function(folder) {
folderId = folder.id;
console.log(folderName + " not found and has been created at ID " + folder.id);
});
}
});
}
Any help to be able to access/print the contents of a bookmark folder would be greatly appreciated! ;)
Thanks in advance!
For those interested:
function populateBookmarks() {
var folderName = "Helium";
$("#marks").hide();
chrome.bookmarks.getChildren("1", function(children) {
var numChildren = children.length;
while(numChildren--) {
if(children[numChildren].title == folderName) {
var bookmarks = chrome.bookmarks.getChildren(children[numChildren].id, function(marks) {
// console.log(marks);
marks.forEach(function(links) {
var posthtml = '<tr><td><a href="' + links.url + '">'+ links.title +'</a></td></tr>';
$("#marks").children("tbody").append(posthtml);
$("#marks").show();
});
});
break;
}
}
});
}