Force firefox to update bookmarks.html file
-
- Posts: 5
- Joined: April 27th, 2008, 9:56 am
Force firefox to update bookmarks.html file
Im a relative newbie to firefox (and these forums) so I really hope this question isn't common knowledge that could be answered elsewhere:)
Im writing an application that reads the bookmarks.html file and extracts the bookmarks. As far as I know Firefox updates this file on exit only. Is there a way to force Firefox to update this file at any time while its running such as a key combination etc?
This needs to be a method that doesn't involve installing an extension.
Many thanks...
Im writing an application that reads the bookmarks.html file and extracts the bookmarks. As far as I know Firefox updates this file on exit only. Is there a way to force Firefox to update this file at any time while its running such as a key combination etc?
This needs to be a method that doesn't involve installing an extension.
Many thanks...
- trolly
- Moderator
- Posts: 39851
- Joined: August 22nd, 2005, 7:25 am
Not that i know.
But be aware that FF3 will use a sqlite database instead of the HTML file.
But be aware that FF3 will use a sqlite database instead of the HTML file.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
- the-edmeister
- Posts: 32249
- Joined: February 25th, 2003, 12:51 am
- Location: Chicago, IL, USA
I haven't seen any documentation regarding that to direct you to, but based upon my observations while 'pushing the limits' in Firefox - no, bookmarks.html is always up-to-date when adding or deleting a bookmark. I share a 'remote' bookmarks.html file among a few Profiles that I run simultaneously, when I add a new bookmark in one Profile it appears in the other Profiles at the same instance. I have seen that happen repeatedly when running 2 or 3 Profiles that were in tiled windows with the bookmarks Sidebar open.Andy wrote:As far as I know Firefox updates this file on exit only.
As trolly mentioned, Firefox 3 uses an all new SQLite database for bookmarks and history called places.sqlite. Now, that file isn't updated until Firefox is closed, from what I have observed in running vs. closed Profile files. It looks like the 'temp' data is held in places.sqlite-journal and/or places.sqlite-stmtjrnl files until the "closing routine" is started and that data is written to places.sqlite when Firefox is closed.
A mind is a terrible thing to waste. Mine has wandered off and I'm out looking for it.
-
- Posts: 5
- Joined: April 27th, 2008, 9:56 am
Thanks for that.
I wasn't aware of the bookmark file changing to sqlite so that was a welcome heads up:) Its my own stupid fault but it makes my task very difficult now though as Ive got solid code to trawl and extract (inc icons) from a bookmarks.html file and there are no similarities between how it is stored then and in FF3. C'est la vie!
Just as an aside it looks like places.sqlite gets locked when a new bookmark is added or a new url is visited but is free to be read before that. It would be nice (from my point of view) if it was locked, updated then released otherwise I'd have to ask my users to close down FF before importing. Not being part of or knowing much about the Firefox community what (who or where) would be the best person to talk to about this?
I wasn't aware of the bookmark file changing to sqlite so that was a welcome heads up:) Its my own stupid fault but it makes my task very difficult now though as Ive got solid code to trawl and extract (inc icons) from a bookmarks.html file and there are no similarities between how it is stored then and in FF3. C'est la vie!
Just as an aside it looks like places.sqlite gets locked when a new bookmark is added or a new url is visited but is free to be read before that. It would be nice (from my point of view) if it was locked, updated then released otherwise I'd have to ask my users to close down FF before importing. Not being part of or knowing much about the Firefox community what (who or where) would be the best person to talk to about this?
- trolly
- Moderator
- Posts: 39851
- Joined: August 22nd, 2005, 7:25 am
-
- Posts: 5937
- Joined: September 23rd, 2005, 5:40 pm
- Location: Tokyo , Japan
@AndyB39
about bookmarks.html(bookmarks.postplaces.html), see https://bugzilla.mozilla.org/show_bug.cgi?id=423082
about bookmarks.html(bookmarks.postplaces.html), see https://bugzilla.mozilla.org/show_bug.cgi?id=423082
-
- Posts: 1428
- Joined: February 19th, 2005, 11:22 am
- the-edmeister
- Posts: 32249
- Joined: February 25th, 2003, 12:51 am
- Location: Chicago, IL, USA
I am running the Minefield nightlies and I can't get that pref to work. It continues to save the backup as JSON.dickvl wrote:There is a pref that makes Firefox 3 create a file bookmarks.html on Exit: browser.bookmarks.autoExportHTML
I don't know if b5 already has it.
A mind is a terrible thing to waste. Mine has wandered off and I'm out looking for it.
-
- Posts: 5
- Joined: April 27th, 2008, 9:56 am
Ive just run the latest nightly and it creates a bookmarks.html file in the same directory as places.sqlite not the backup dirs.
As C@rb0n said though I don't want to FF to chug on large bookmark sets plus I can't update the config of FF on the fly for a user (theres no way to do it unless I change prefs.js when FF isnt running and the rfdid's are missing from the bookmarks file anyway). So no point using browser.bookmarks.autoExportHTML unfortunatly.
Decided to implement sqlite instead and go from there. It would be nice if FF didn't lock the places file from the first url/bookmark change though - I can understand it from a performance point of view I but I only need read only access..
As C@rb0n said though I don't want to FF to chug on large bookmark sets plus I can't update the config of FF on the fly for a user (theres no way to do it unless I change prefs.js when FF isnt running and the rfdid's are missing from the bookmarks file anyway). So no point using browser.bookmarks.autoExportHTML unfortunatly.
Decided to implement sqlite instead and go from there. It would be nice if FF didn't lock the places file from the first url/bookmark change though - I can understand it from a performance point of view I but I only need read only access..
-
- Posts: 6108
- Joined: November 18th, 2002, 11:07 am
You have two good options:
1) Write an extension that exports the bookmarks whenever they are changed. This could export in whatever format you want - so you don't even need to parse bookmarks.html.
2) Write a program that uses the sqlite database tool to query the file. There are a number of example programs out there to start with.
I like #1 as it has almost no overhead and immediately updates whatever destination you desire.
1) Write an extension that exports the bookmarks whenever they are changed. This could export in whatever format you want - so you don't even need to parse bookmarks.html.
2) Write a program that uses the sqlite database tool to query the file. There are a number of example programs out there to start with.
I like #1 as it has almost no overhead and immediately updates whatever destination you desire.
- dickvl
- Posts: 54163
- Joined: July 18th, 2005, 3:25 am
The backups are still in JSON if you set the pref browser.bookmarks.autoExportHTML.
Only there will be a file bookmarks.html created in the main profile folder, just like Firefox 2 does.
That bookmarks.html file also has the 'Unfiled' bookmarks at the end, so you have them all.
I haven't yet tried to import such a file to see what happens with the currently unfiled bookmarks (merge or remove double or replace?).
Only there will be a file bookmarks.html created in the main profile folder, just like Firefox 2 does.
That bookmarks.html file also has the 'Unfiled' bookmarks at the end, so you have them all.
I haven't yet tried to import such a file to see what happens with the currently unfiled bookmarks (merge or remove double or replace?).
- a;skdjfajf;ak
- Posts: 17002
- Joined: July 10th, 2004, 8:44 am
- the-edmeister
- Posts: 32249
- Joined: February 25th, 2003, 12:51 am
- Location: Chicago, IL, USA
OK, now I see that the existing bookmarks.html file directly in the Profiles folder does get updated upon closing Minefield when that preference is set, I was expecting it to appear in the \bookmarkbackups\ folder in place of the JSON file.dickvl wrote:Only there will be a file bookmarks.html created in the main profile folder, just like Firefox 2 does.
BookmarkBackup for 1.5 and higher has code to do timed interval backups of bookmarks.html. I think the pref is bookmarkbackup.interval where the default value is 120 (seconds). That code isn't gonna help Andy with Firefox 3 and Places, directly, but it might give him some ideas.Racer wrote:1) Write an extension that exports the bookmarks whenever they are changed. This could export in whatever format you want - so you don't even need to parse bookmarks.html.
Ed
A mind is a terrible thing to waste. Mine has wandered off and I'm out looking for it.