indexeddb

浏览器数据库 IndexedDB 教程

为君一笑 提交于 2019-12-21 05:00:29
浏览器数据库 IndexedDB 教程 阅读 171 收藏 23 2018-08-12 原文链接: mp.weixin.qq.com 腾讯云优惠套餐免费赠送50GB对象存储空间,加8元可选1年域名服务,助力学生党秒变云计算达人。 cloud.tencent.com 概述 随着浏览器的功能不断增强,越来越多的网站开始考虑,将大量数据储存在客户端,这样可以减少从服务器获取数据,直接从本地获取数据。 现有的浏览器数据储存方案,都不适合储存大量数据:Cookie 的大小不超过4KB,且每次请求都会发送回服务器;LocalStorage 在 2.5MB 到 10MB 之间(各家浏览器不同),而且不提供搜索功能,不能建立自定义的索引。所以,需要一种新的解决方案,这就是 IndexedDB 诞生的背景。 通俗地说,IndexedDB 就是浏览器提供的本地数据库,它可以被网页脚本创建和操作。IndexedDB 允许储存大量数据,提供查找接口,还能建立索引。这些都是 LocalStorage 所不具备的。就数据库类型而言,IndexedDB 不属于关系型数据库(不支持 SQL 查询语句),更接近 NoSQL 数据库。 IndexedDB 具有以下特点。 (1)键值对储存。 IndexedDB 内部采用对象仓库(object store)存放数据。所有类型的数据都可以直接存入,包括

What is the difference between add and put in indexeddb?

倾然丶 夕夏残阳落幕 提交于 2019-12-21 03:42:42
问题 I am just starting to use indexeddb and transforming Web SQL. I tried to use add and put to add some data in data store. I could not really see what is/are the difference/s of using these two functions. I think I have to know the difference so I could use them appropriately. Thanks forward 回答1: The difference between add and put is same as in any API. If you try to insert an element with key that already exist using the put function it will trigger and update of the existing element, however

How do you delete the indexed databases stored on your computer in Firefox?

人走茶凉 提交于 2019-12-20 10:23:43
问题 In Opera you can simply type in opera:webdatabases in the address field and delete all the web SQL databases stored on your computer. How do you do the same in Firefox? I need to delete an IndexedDB on my localhost to experiment with a fresh version. 回答1: I know this is old, but there is a way to do this in Firefox: Go to Tools -> Page Info Go to the "Permissions" tab Scroll down to "Maintain Offline Storage" Click "Clear Storage" 回答2: I figured out how to delete the databases. Windows stores

HTML5 web storage abstraction libraries

雨燕双飞 提交于 2019-12-20 06:11:04
问题 From what I've read of web storage in HTML5, there are a number of different storage options with varying support across different browsers. Are there any popular libraries for abstraction of web storage in HTML5 applications? 回答1: There are a couple of YUI-based libraries for abstracting the underlying storage away: YUI 2: Storage Utility YUI 3: Storage Lite You'd need to port them if you wanted to use them with another library, though it looks like someone has already done that for jQuery.

undefined indexedDB on Windows Phone 8.1 javascript app

北城以北 提交于 2019-12-20 02:50:51
问题 I have the following code on a (HTML/javascript) Windows Store app var reqOpen = window.indexedDB.open(that.dbName, that.dbVersion); The thing is, when I wanted to use that exact code on a (HTML/javascript) Windows Phone 8.1 app I get undefined on window.indexedDB . I can't seem to find any samples or anything related to indexedDB on WinPhone. The only article that I found that mentions both Windows Store and Windows Phone apps is this one, but it is not clear if there's a difference for

Storage limit for indexeddb on IE10

风流意气都作罢 提交于 2019-12-19 06:34:02
问题 We are building a web-app that store lots of files as blobs with indexedDB. If the user uses our app at its maximum, we could store as much as 15GB of file in indexeddb. We ran into a problem with IE10, that I strongly suspect is a quota issue. After having successfully saved some files, a new call to store.put(data, key); will never ends. Basically, the function will be called, but no success event nor error event will be called. If I look into the IndexedDB folder of IE 10 I'll see a

Storage limit for indexeddb on IE10

若如初见. 提交于 2019-12-19 06:31:34
问题 We are building a web-app that store lots of files as blobs with indexedDB. If the user uses our app at its maximum, we could store as much as 15GB of file in indexeddb. We ran into a problem with IE10, that I strongly suspect is a quota issue. After having successfully saved some files, a new call to store.put(data, key); will never ends. Basically, the function will be called, but no success event nor error event will be called. If I look into the IndexedDB folder of IE 10 I'll see a

Import and Export Indexeddb data

大城市里の小女人 提交于 2019-12-19 04:00:57
问题 I have an Epub annotation plugin where user can annotate the Epub, but the annotated text is stored in the browser in browser's indexeddb database, want to export those annotated text to an file and in other system i want to import those file to my indexeddb database. How can I do this , can any one suggest any idea along with some URLS , examples, code. 回答1: You can get anything out of an IndexedDB database as a JavaScript object. Then you can use JSON.stringify to turn it into a JSON string

Chrome shows only up to 50 rows of indexeddb table data

半腔热情 提交于 2019-12-19 03:58:36
问题 I am experimenting with indexeddb, and have some data added to ObjectStore which should have 90 rows. But I can see only 50 rows in Chrome development tools. Is it Chrome that limits the rows, or my code is not adding more than 50 rows? For example: for (var i=0; i< 100; i++){ var tmp = "data" + i; store.put({question: tmp}); } this code adds only 50 rows/data into store even though I am adding 100. Thanks forward 回答1: You can navigate through all items in the Chrome resource tab using the

Check if IndexedDB database exists

邮差的信 提交于 2019-12-18 18:53:19
问题 Is there a way to check if an IndexedDB database already exists? When a program tries to open a database that does not exists the database is created. The only way that I can think of is something like the following, where I test if an objectStore already exists, if it doesn't, the database is deleted: var dbexists=false; var request = window.indexedDB.open("TestDatabase"); request.onupgradeneeded = function(e) { db = e.target.result; if (!db.objectStoreNames.contains('todo')) { db.close();