Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/377.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为什么在chrome中打开db后很长一段时间indexedDB触发成功_Javascript_Indexeddb - Fatal编程技术网

Javascript 为什么在chrome中打开db后很长一段时间indexedDB触发成功

Javascript 为什么在chrome中打开db后很长一段时间indexedDB触发成功,javascript,indexeddb,Javascript,Indexeddb,首先打开页面时,在indexedDB.open之后触发onsuccess事件需要很长时间(有时需要2000ms,但有时很快) 这是chrome和IE的问题,但不是firefox的问题。 Firefox可以稳定地在100毫秒内打开 _openDb: function () { var beforeTime = new Date().getTime(), request = indexedDB.open(self.dbName, self.version); request.o

首先打开页面时,在indexedDB.open之后触发onsuccess事件需要很长时间(有时需要2000ms,但有时很快)

这是chrome和IE的问题,但不是firefox的问题。 Firefox可以稳定地在100毫秒内打开

_openDb: function () {
  var beforeTime = new Date().getTime(),
      request = indexedDB.open(self.dbName, self.version);

  request.onupgradeneeded = function (event) { /* ... */ };

  request.onsuccess = function (res) { 
    var curTime = new Date().getTime();
    console.log('open db: ', curTime - beforeTime);
  };

  request.onerror = function (e) { /* ... */ }

}

_openDb()
先打开页面:
铬合金69/72/75:开放数据库:4439
firefox:open db:81

按F5键:
铬:db:48
firefox:open db:93

为什么chrome打开的动作如此缓慢,它只发生在第一个进入页面。我怀疑这是Chrome浏览器的问题,为我不完整的描述道歉,并感谢所有的帮助