Manipulating Google Chrome bookmarks from external program (and make Chrome aware)?

Lasse V. Karlsen picture Lasse V. Karlsen · Mar 7, 2011 · Viewed 17.3k times · Source

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.

Answer

useraged picture useraged · Jul 26, 2011

%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.