简体   繁体   English

如何使用 IndexedDBShim 设置初始数据库大小?

[英]How do I set the initial database size with IndexedDBShim?

I am using the polyfill IndexedDBShim to create a database on iOS Safari 7.1.我正在使用 polyfill IndexedDBShim在 iOS Safari 7.1 上创建一个数据库。 However, it throws an error in indexeddbshim.min.js (line 118) and then tells me:但是,它在 indexeddbshim.min.js(第 118 行)中引发错误,然后告诉我:

"Application cache update failed, because size quota was exceeded."

despite the entire app being 1.06 MB.尽管整个应用程序只有 1.06 MB。 But I think indexeddbshim is requesting too large a size to start (I believe in iOS 7.1, you need to first request less than 5MB in WebSQL to start before increasing it after)但我认为 indexeddbshim 请求的大小太大而无法启动(我相信在 iOS 7.1 中,您需要先在 WebSQL 中请求小于 5MB 才能启动,然后再增加它)

All I can find is this:我能找到的只有这个:

var request = indexedDB.open( "mydbname", 1.0 );

If I try adding in a size variable it doesn't work, and neither does the "const" I found someone else mention online:如果我尝试添加大小变量,它不起作用,而且我在网上找到其他人提到的“const”也不起作用:

//Neither of these options work
var DEFAULT_DB_SIZE = 1 * 1024 * 1024;
var request = indexedDB.open( "mydbname", 1.0, DEFAULT_DB_SIZE );

How can I set the WebSQL initial size?如何设置 WebSQL 初始大小?

Inside the indexeddbshim.js file, there is a line like this:在 indexeddbshim.js 文件中,有这样一行:

var DEFAULT_DB_SIZE = 4 * 1024 * 1024;

which corresponds to an initial size of 4MB (in version 2.2.1 of the unminified file it is in line 2996).它对应于 4MB 的初始大小(在未缩小文件的 2.2.1 版中,它位于第 2996 行)。

Edit this line inside indexeddbshim.js to be a different value, and then retry.将 indexeddbshim.js 中的这一行编辑为不同的值,然后重试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在加载时使用JavaScript设置初始CSS值? - How do I set initial CSS values with JavaScript on load? 如何将初始 state 设置为使用 useQuery 获取的数据? - How do I set initial state to data fetched with useQuery? 如何设置PhosphorJS小部件的(初始)大小 - How to set the (initial) size of PhosphorJS Widgets 如何在 5 秒后将“display:none”设置为我之前在 JavaScript 中设置“display:initial”的 div? - How do I set “display:none” after 5 seconds to the div i previously set “display:initial” in JavaScript? 如何允许resizable()将大小增加到超出初始大小? - How can I allow resizable() to increase size beyond initial size? 在按下“添加属性”之前,如何设置初始默认输入字段? - How do I set initial default input fields, prior to “Add Property” being pressed? 如何从 API 响应中设置 ANT 设计初始值表单 - How do I set ANT DESIGN INITIAL VALUE form from API response 如何减少该数据库的大小? - How do I cut down on this database's size? 如何在初始页面加载时使用 React-Redux 将变量设置为值? - How do I set a variable to value using React-Redux on the initial page load? 我如何知道在 JavaScript 中构造 Set 的大小限制是多少? - How do I know what is the size limit for constructing a Set in JavaScript?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM