20

Is there any documented way for an external program to manipulate the Google Chrome bookmarks?

The bookmarks are stored in a "Bookmarks" file in the user data\default directory, looks like JSon or something to me (that's not important right now.)

However, is there any way I can inform Chrome that the file has changed?

Note: This is for Windows, and I'm looking for a way to programmatically make Chrome aware of my changes.

I tried the following:

  1. Edit the file manually
  2. Restart Chrome

The changes were present, but until I restarted Chrome, Chrome was not aware of my changes, and I assume strongly that if I edit the bookmarks inside Chrome before restarting, the external changes are lost.

So, is there a way for me to do this? Or do I have to just inform the user that unfortunately I have to close his Chrome installation, edit the bookmark file, and then restart Chrome?

The code is ultimately going to be written in C#, but unless you have/know of code that does this, the way to go about it should probably be language/runtime agnostic.

Also note that my current list of things that I want to automate are:

  1. Create a folder for some specific bookmarks
  2. Delete existing bookmarks in that folder
  3. Add new bookmarks to that folder

The purpose of this program is to automate setting up local copies of a web application we make, where support/testers can just run the program, pick the version of the program to set up and which database to connect it to, and then the program automates everything. I'd like for this program to add easy access to the applications as well.

Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825
  • Does platform/OS matter? – TNC Mar 07 '11 at 09:40
  • Well, yes, this is on Windows, let me edit the question. – Lasse V. Karlsen Mar 07 '11 at 09:55
  • 1
    @Boris Because the important part was that a program I developed in-house created local copies of some web applications we make, for testing purposes, and I wanted to automatically create bookmarks for the testers. I ended up just supporting IE on this since it stores its bookmarks on disk as files. – Lasse V. Karlsen Jun 02 '11 at 20:39
  • 1
    For Enterprise deployments, there's work being done on allowing control of bookmarks via policy, which would certainly be more reliable than manipulating Chrome's on-disk representation. http://crbug.com/49598 contains the details; star it if you'd like updates. – Mike West Jun 04 '11 at 09:16

1 Answers1

14

%LOCALAPPDATA%\Google\Chrome\User Data\Default\Bookmarks file is protected by a checksum for writing errors. Google Chrome make a backup of this file as Bookmarks.bak. So if Bookmarks file is corrupt, Google Chome uses backup file for restoring bookmarks.

Checksum operation is a bit tricky. You can look at it's source (as Chromium project is open source). It seems that Chrome does MD5 calculation on every bookmark's:

  • id
  • title
  • folder
  • url

So you can look this source code for investigate further.

But i do not recommend to do this. Google may change this format without any notice and your software suffers incompatibility problems. It would be better to write an Google Chrome extension and interoperate with your desktop software.

useraged
  • 1,706
  • 17
  • 34