0

How to manipulate LocalStorage from a browser based on the TChromim component in a Delphi application? To create it using Javascript, however, I need to consult with Delphi. Here is an example of how I create LocalStorage and handle with javascript:

chromium.Browser.MainFrame.ExecuteJavaScript("
var db = openDatabase('myDB', '1.0', 'Test DB', 2 * 1024 * 1024);
var msg,sql;
var maior, i;


db.transaction(function (qry) {
   qry.executeSql('CREATE TABLE IF NOT EXISTS  myTable   (
                  id_link INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
                  link TEXT NOT NULL 
            );', [], null, null);     
});

db.transaction(function (qry) {
   sql = 'INSERT INTO myTable ( link) VALUES (".com.br")';
   console.log(sql);
   qry.executeSql(sql, [], null, null);  

});

db.transaction(function (qry) {
   qry.executeSql('SELECT * FROM myTable', [], function (qry, results) {
      var len = results.rows.length;
      msg = "Total Registros da busca: " + len ;
      console.log(msg);

      for (i = 0; i < len; i++){
          msg =  results.rows.item(i).id_link + " - " +results.rows.item(i).link;
         console.log(msg);
      }
   }, null);
}); ", '', 0);

Thank you.

  • Not sure what you're asking. Does the Javascript you quote a) execute and b) produce the expected results? – MartynA May 12 '17 at 18:48
  • Hello, with the above code I create the database, the table in the local database of the browser (html5) and I can do all operations with javascript (query, insert, delete, update), however I wanted to get this information through codes In pascal (Delphi) and use it s.. – Junior Miguel Vieira May 12 '17 at 20:19

0 Answers0