Bookmarks file format

Discussion of general topics about Mozilla Firefox
Post Reply
svylbowe
Posts: 2
Joined: January 26th, 2006, 3:27 pm

Bookmarks file format

Post by svylbowe »

Which file is used to store bookmarks in my profile? Where is this file documented?

The reason that I am asking is that I intend to manipulate my firefox bookmarks with a 3rd party tool. It is important that I can both read existing bookmarks as well as write new ones.
Solitary Man
Posts: 39
Joined: January 12th, 2006, 6:00 pm
Location: Around the bend

Post by Solitary Man »

The name of the bookmark file is bookmarks.html. Not sure what you mean by file documented.

Some handy links.

Knowledge Base

FAQ's

Category:Firefox

http://kb.mozillazine.org/Category:Issues_(Firefox)

Firefox_links

Edit: tried fixed a link.
I'll be what I am.
User avatar
dickvl
Posts: 54145
Joined: July 18th, 2005, 3:25 am

Re: Bookmarks file format

Post by dickvl »

svylbowe wrote:Which file is used to store bookmarks in my profile? Where is this file documented?

The reason that I am asking is that I intend to manipulate my firefox bookmarks with a 3rd party tool. It is important that I can both read existing bookmarks as well as write new ones.

The format roughly looks like this:
Firefox Bookmark File Format wrote:<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1 LAST_MODIFIED="{date}">Bookmarks</H1>

<DL>
{item}
{item}
{item}
.
</DL>

Folder item:
<DT><H3 ADD_DATE="{date}" LAST_MODIFIED="{date}">{title}</H3>
<DD>{description}
<DL><p>
{item}
</DL><p>

Normal item:
<DT><A HREF="{url}" SHORTCUTURL="{keyword}" ICON="{data:icon}" ADD_DATE="{date}" LAST_MODIFIED="{date}" LAST_VISIT="{date}" ID="{rdf:id}">{title}</A>
<DD>{description}

Seperator item:
<HR>

note: {date} is a decimal integer that represents the number of seconds elapsed since 1 January 1970 0:00am
svylbowe
Posts: 2
Joined: January 26th, 2006, 3:27 pm

Post by svylbowe »

Thanks, that was just what I was looking for! One thing, that still puzzles me though, is the ID-attribute. How is that determined? This is important if I want to add bookmarks outside firefox. These new bookmarks should have IDs that match firefox's expectations.
User avatar
dickvl
Posts: 54145
Joined: July 18th, 2005, 3:25 am

Post by dickvl »

svylbowe wrote:Thanks, that was just what I was looking for! One thing, that still puzzles me though, is the ID-attribute. How is that determined? This is important if I want to add bookmarks outside firefox. These new bookmarks should have IDs that match firefox's expectations.
Maybe that's a question for the Firefox Builds or Tech forum. I don't know, I guess you'd have to know the source code and I suppose that they are created as random and maybe only used as an id to access the bookmark via the rdf interface.
You can read more about RDF here: http://www.mozilla.org/rdf/doc/
User avatar
Thumper
Posts: 8037
Joined: November 4th, 2002, 5:42 pm
Location: Linlithgow, Scotland
Contact:

Post by Thumper »

You can leave the IDs off and Firefox will assign new ones itself.

There is a reason the file has DO NOT EDIT at the top. It isn't designed to be processed by anything other than Firefox. The format is icky and dated and is being removed entirely for the next release of Firefox, where you will be able to use SQL to query Firefox's proper bookmarks database.

- Chris
casey1992
Posts: 696
Joined: December 10th, 2003, 1:20 am

Post by casey1992 »

Wouldn't the key be the 3rd party tool being designed not to muck up Firefox? If it's able to write in the correct format, I don't see where the problem would be.

It will get interesting when Firefox updates its bookmark format. The third party bookmark applications will all need updates. As soon as that happens, we'll see the posts blaming Firefox for the fact that these programs haven't been updated. ;)
User avatar
Thumper
Posts: 8037
Joined: November 4th, 2002, 5:42 pm
Location: Linlithgow, Scotland
Contact:

Post by Thumper »

casey1992 wrote:Wouldn't the key be the 3rd party tool being designed not to muck up Firefox? If it's able to write in the correct format, I don't see where the problem would be.


The file format is sparsely documented and absolutely unsupported. My note was more by way of advice that there really isn't anywhere to turn for further advice on the subject.

- Chris
Post Reply