Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 827
Lasse V. Karlsen Avatar asked Mar 07 '11 09:03

Lasse V. Karlsen


People also ask

Can I access my bookmarks from another computer Chrome?

To access your bookmarks using your Google account you have to log in with your Gmail account first, then sync your account. After that whenever you add bookmarks it will sync with your account and you can access them on any device on the web browser.

Can you edit Chrome bookmarks file?

Right-click the Bookmark, and then click “Edit.” In the window that opens, you can change the name, URL (though you usually shouldn't change this), and the folder in which it's stored by highlighting the destination folder. Once you've edited the Bookmark, click “Save.”

How do I override Chrome bookmarks?

You don't have to uninstall chrome. Just go into the Bookmarks manager, select the first bookmark, and use shift when selecting the the last bookmark to highlight them all, then hit delete on your keyboard. Import the new file.


1 Answers

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

like image 85
useraged Avatar answered Sep 21 '22 08:09

useraged