1

I'm trying to build an offline web application which can sync online if the network is available. I tryed jQuery jStore but the test page stop at "testing..." whitout result, then I tryed Google Gears which is supposed to be working on the phone but it is not found.

 if (window.google && google.gears)
 {
  google.gears.factory.getPermission();

  // Database
  var db = google.gears.factory.create('beta.database');
  db.open('foobar');
  db.execute('create table if not exists Lectures' +
           ' (ID_COMPTEUR int, DATE_HEURE timestamp, kWh float, Wmax float, VAmax float, Wcum float, VAcum float);');

 }
else
{
alert('Google Gears non trouvé.');      
}

the code does work on Google Chrome v5.

[edit]

alert(window.google); on the phone is undefined, but is an object in Chrome.

alert(google.gears); does nothing on the phone and jam the javascript, but is an object in Chrome.

[edit 2]

in the phone configuration, gears is activated.

[edit 3]

to be clear, you have to use google.gears database on Android 1.5, and html5's localStorage on Android 2.x

4

1 回答 1

1

知道了!“gears_init.js”未正确加载。我的代码正在使用:

<script type="text/javascript" src="gears_init.js"></script>

没有在本地保存文件。我从谷歌下载了文件,现在它可以工作了。我不知道为什么 Chrome 在 chrome 上正常工作..

于 2010-04-09T17:24:12.990 回答