Reputation: 10907
I want to be able to include an sqlite file with a Chrome Extension, and make it so that the extension can perform read/write ops on that db. I will be using it for process intercom (by lack of alternatives) so I can override configs / pass command-line parameters / etc. to Chrome.
Can someone please point me in the right direction?
Upvotes: 1
Views: 534
Reputation: 10907
OP here.
Partially solved. Chrome supports passing --user-data-dir=%appdata%/whatever
From where in my external application I can access %appdata%/Whatever/databases/Databases.db
, open Databases
table, filter by origin, get an ID
and open %appdata%/Whatever/databases/origin/ID
. It's somewhat hackish but will do.
What puzzles me now is that:
openDatabase('X','1.0','plm',100*1024*1024);
I was expecting some resistance at asking 100MB without "unlimitedStorage" permissionchrome-extension_bhapcikibejcipnnpimookjaibhlddfd_0
might be inconsistent; is it safe to hardcode in the other application?Upvotes: 0
Reputation: 6824
You can't do what you want by shipping a file AFAIK, but since WebSQL in Chrome is essentially SQLite you could ship your "database" as JSON datastructures in your code, and use that to initialize a WebSQL instance in Chrome when you initialize the WebSQL database for your application/extension.
Upvotes: 1
Reputation: 7486
Chrome is very strict when it comes to use outside files.
Anyway, Chrome extensions should use localStorage. Something like:
localStorage["varName"] = data;
or
localStorage.varName = data
and
var data = localStorage.varName
Check for more info here
Upvotes: 0