Search code examples
javascriptfirefoxbookmarks

Find if a Firefox bookmark element is a Folder or a link


I'm writting some code to explore the bookmarks of Firefox ( https://developer.mozilla.org/en/Retrieving_part_of_the_bookmarks_tree ) and I need to know if a node of the tree of bookmarks is a folder or a link.

How can I do this ? (Using typeof I get object for both the folders and the links).


Solution

  • Browsing the Web I found that node.type returns an integer. If the integer is 0 then the element is a link and if the integer is 6 the element is a folder ( http://www.javascriptkit.com/domref/nodetype.shtml ).