Is it possible to make chrome extension that interacts with sqlite database similarly as firefox extension? Could you give me some advise or link where is more info about developing chrome extension interacting with sqlite?
thank you
You can use Web SQL API which is an ordinary SQLite database in your browser and you can open/modify it like any other SQLite databases for example with Lita. Chrome locates databases automatically according to domain names or extension id.
Chrome Cookies are stored in the 'Cookies' SQLite database (located in the Network folder), within the 'cookies' table. Chrome Downloads are stored in the 'History' SQLite database, within the 'downloads' and 'downloads_url_chains' tables.
You can use Web SQL API which is an ordinary SQLite database in your browser and you can open/modify it like any other SQLite databases for example with Lita.
Chrome locates databases automatically according to domain names or extension id. A few months ago I posted on my blog short article on how to delete Chrome's database because when you're testing some functionality it's quite useful.
You might be able to make use of sql.js.
sql.js is a port of SQLite to JavaScript, by compiling the SQLite C code with Emscripten. no C bindings or node-gyp compilation here.
<script src='js/sql.js'></script> <script> //Create the database var db = new SQL.Database(); // Run a query without reading the results db.run("CREATE TABLE test (col1, col2);"); // Insert two rows: (1,111) and (2,222) db.run("INSERT INTO test VALUES (?,?), (?,?)", [1,111,2,222]); // Prepare a statement var stmt = db.prepare("SELECT * FROM test WHERE col1 BETWEEN $start AND $end"); stmt.getAsObject({$start:1, $end:1}); // {col1:1, col2:111} // Bind new values stmt.bind({$start:1, $end:2}); while(stmt.step()) { // var row = stmt.getAsObject(); // [...] do something with the row of result } </script>
sql.js
is a single JavaScript file and is about 1.5MiB in size currently. While this could be a problem in a web-page, the size is probably acceptable for an extension.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With