如何在Safari 10.1.2及更高版本中使用Dexie.js(v 2.0.1)数据库?

问题描述 投票:0回答:1

它在Chrome中运行良好,但在Safari中没有任何反应。

我这样使用它:

const deviceUserData = new Dexie('deviceUserData')

 deviceUserData.version(1).stores({  userData: 'userName, data'})
 deviceUserData.open()
 .then(result =>{
           console.log('open own DB, data:', result)  // doesn't happen
 })
 .catch(function(error) {
           console.error('Uh oh : ' + error)          // doesn't happen
 });

如何在Safari 10及更高版本中访问数据库?

javascript safari indexeddb dexie
1个回答
0
投票

Dexie适用于Safari 10.1及更高版本。你的样品不应该有任何问题。但是,可能还有其他因素在起作用:

  • 数据库是在早期版本的浏览器中创建的,浏览器已升级。如果是这样,Safari可能会触发错误。
  • 在iframe中使用Dexie。
  • 包括来自cdn的dexie.js(不同来源)
  • 从文件系统而不是http提供html页面
  • 使用indexeddbshim?
© www.soinside.com 2019 - 2024. All rights reserved.