Retrieving 'Other Bookmarks' folder ID

976 views
Skip to first unread message

MarkLunney

unread,
Jun 2, 2010, 5:54:59 AM6/2/10
to Chromium-extensions
For synced storage, my extension creates a folder in the user's other
bookmarks folder (set to lower case to allow for Mac) :

chrome.bookmarks.getChildren('0', function(BookmarkTreeNode) {
BookmarkTreeNode.forEach(function(b) {

if (b.title.toLowerCase() == 'other bookmarks')
{
setFolder (b.id);
//Perform all folder actions on this folder ID
}
}
)
});

Works fine for me on tests on Windows, Mac and Linux.

But I've had reports of the extension not working on Mac/Linux (no
reports for Windows). Is there any reason this wouldn't work?

It could be a completely separate issue, but as I can't recreate this
error my instinct is that its this part of the code failing.

The extension is Papercuts - https://chrome.google.com/extensions/detail/kjodbaafiacnpklaepiaplhbbiomipmc.

MarkLunney

unread,
Jun 2, 2010, 9:13:55 AM6/2/10
to Chromium-extensions
Think I've found the problem, Other bookmarks isn't always in English!
Seems obvious now.

I'm adding an option for the user to change this, but is there an
automatic way of retrieving Chrome's default name for the 'Other
bookmarks' folder?
> The extension is Papercuts  -https://chrome.google.com/extensions/detail/kjodbaafiacnpklaepiaplhbb....

PhistucK

unread,
Jun 2, 2010, 11:26:27 AM6/2/10
to MarkLunney, Chromium-extensions
I believe there are always two top level folders, so I imagine their IDs or something, their order, would be the same across all of the languages.

☆PhistucK



--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.


MarkLunney

unread,
Jun 2, 2010, 11:29:57 AM6/2/10
to Chromium-extensions
I'd have though this would be the case, but doesn't seem to be true.

From what I can tell , 0 is the root ID, 1 is the Bookmark bar ID, but
then all bookmarks on the bar will be ID 2+ , with the Other bookmarks
coming after this.

I think this has already been reported as a bug, but the only solution
I could find for now was to search for the folder by title.
> > To post to this group, send email to chromium-extensi...@chromium.org.
> > To unsubscribe from this group, send email to
> > chromium-extensions+unsubscr...@chromium.org<chromium-extensions%2Bunsubscr...@chromium.org>
> > .

Gabriel Gonzalez

unread,
Jul 9, 2010, 12:45:04 PM7/9/10
to Chromium-extensions
var otherBookmarksID = 0;
chrome.bookmarks.getTree(function(tree){
otherBookmarksID = tree[0].children[1].id;
});

Works fine for me and no matters the language...

Mark Lunney

unread,
Jul 12, 2010, 9:26:04 AM7/12/10
to Chromium-extensions
Thanks Gabriel, I figured that this was the best way of doing it too.
Reply all
Reply to author
Forward
0 new messages