30

I am building a chrome extension which will only be available for people within the company I work for. The extension needs input - which can be generated with a simple query to a shared MySQL DB server (to which all employees can access with read only permissions).

The question is - since the extension is all client side (mainly Javascript) - what's the simplest way to access the DB and run the query? Do I have to create a php/java(/...) service which does that for the extension?

Galz
  • 6,713
  • 4
  • 33
  • 39

1 Answers1

38

You'll have to create an intermediary web app that will interface with the Database. Then you can make AJAX calls from the extension to your web app's API, which will in turn query the database and return results.

Chrome Extension → Web App API → MySQL

More info on Chrome AJAX API here

gignu
  • 1,763
  • 1
  • 14
  • 24
sym3tri
  • 3,747
  • 1
  • 29
  • 25
  • I would go for this solution, too. Saves you e.g. from various kinds of non-standard port issues. – Uwe Keim Apr 24 '11 at 06:53
  • I like this solution. Along the lines of what I was looking for. – James P. Aug 24 '12 at 16:14
  • @sym3tri Can this solution work offline,If i want to have an offline chrome app to be storing data, can i have some embedded db in my chrome app? I cant use php or mysql because that will mean the user to install apache,mysql for the app to work – indago Feb 27 '14 at 08:36