2

Can I use javascript in a Google Chrome packaged app (a.k.a. browser extension) to read a user's local registry key (i.e. stored query url, a.k.a. the search_url key for Google Desktop)? If so, some example code to access this would be much appreciated!

Background / Detail

I am trying to write a browser plugin which opens up the users Google Desktop homepage in their Chrome browser. The url is: http://127.0.0.1:4664/&s={search_url key}

According to the Google Desktop API docs, this can be accomplished by using the HTTP/XML-Based Query API. I'm hoping that there is an HTML5 specification (e.g. File API) which provides a standard procedure to read local files, given the users permission.

In order to do this, I need read access for the local search_url key. Depending on the user's OS, the API doc offers two possible local file locations that contain the search_url key:

Windows

HKEY_CURRENT_USER\Software\Google\Google Desktop\API\search_url

Mac OS X

CFStringRef val = CFPreferencesCopyValue(
    CFSTR("search_url"),
    CFSTR("com.google.Desktop.WebServer"),
    kCFPreferencesCurrentUser,
    kCFPreferencesAnyHost);
if (val) {
  // act on the value
  CFRelease(val);
}  

Alternative Approach for Windows OS

Apparently, NPAPI (http://code.google.com/chrome/extensions/npapi.html) allows a Chrome app to run a dll in Windows, but I'm not very familiar with the Windows API or VB and would like to avoid using them, if possible.

joelhaus
  • 903
  • 1
  • 10
  • 18
  • 1
    Do you realize the sheer magnitude of the security hole you're asking for? – SLaks Jan 26 '11 at 00:42
  • Thank you for the response SLaks. I understand that there are risks and I realized that I mis-worded my question (changed from web app to browser plugin). Given that this is a client side browser plugin, can't a user permit read access? In addition, this is only required for a specific file path. Is the fact that it's in the registry raising a red flag? – joelhaus Jan 26 '11 at 01:12
  • Found this related article about HTML5 File API, but looks like a user must actively provide file path: http://www.html5rocks.com/tutorials/file/dndfiles/#toc-selecting-files – joelhaus Jan 26 '11 at 01:20

1 Answers1

2

Unfortunately you cannot access the Windows Registery unless you do it using NPAPI.

Mohamed Mansour
  • 39,445
  • 10
  • 116
  • 90