Do more on the web, with a fast and secure browser!

Download Opera browser with:

  • built-in ad blocker
  • battery saver
  • free VPN
Download Opera

bookmarks root indexes

  • can we rely on bookmarks root indexes to be always the same?
    bookmarkTreeNodes[0] --> bookmarks bar
    bookmarkTreeNodes[1] --> other (imported)
    etc...
    ...or they are different for every user?
    I made extension that works with indexes as base for organization...
    and now user reported that its root folders are wrong

  • Hi,

    You should not rely on array indices at all. You can use id property of a node. The id property should be consistent across browser restarts as stated in: https://developer.chrome.com/extensions/bookmarks#type-BookmarkTreeNode
    Also you can't assume that on the new profile bookmarks bar will always be 1 etc

  • yea, I get that..on the hard way ツ
    I switched to getRootByName in my extension
    but it wasn't documented anywhere

    btw. id's are not consistent...they are changed when adding new nodes (folders/bookmarks)
    Chrome doesn't behave like that
    BB is first child, other bookmarks is second (0 & 1). Everything else falls into those two.
    In Opera other "major" roots switch their id's when something is added

Locked