1 IndexedDB exmample
IndexedDB is the successor to both LocalStorage and WebSQL, designed to replace them as the “one true” browser database. It exposes an asynchronous API that supposedly avoids blocking the DOM, but as we’ll see below, it doesn’t necessarily live up to the hype. Browser support is extremely spotty, with only Chrome and Firefox having fully usable implementations.
WebSQL is an API that is only supported in Chrome and Safari (and Android and iOS by extension). It provides an asynchronous, transactional interface to SQLite. Since 2010, it has been deprecated in favor of IndexedDB.
3 LocalStorage（跨域时ios 10+下退出应用会自动清除，安卓不会）
LocalStorage is a lightweight way to store key-value pairs. The API is very simple, but usage is capped at 5MB in many browsers. Plus the API is synchronous, so as we’ll see later, it can block the DOM. Browser support is very good.
WebKit data (localstorage or local SQLite) are now stored in Library/ Caches folder (instead of Library/WebKit folder). This is a big problem for all apps using UIWebView and storing user data, because they will no longer be backed up and may be deleted. There are a lot of apps using localstorage or SQLite as a critical feature.
The SQLite database gets deleted because the database is saved in a location on the filesystem which Apple does not consider to contain persistent data.
The WebKit data are stored in Library/Caches folder, and can be
source from : https://issues.apache.org/jira/browse/CB-330 如果是自建app可以设置缓存文件的路径到Documents目录下，如果是第三方app没做这样的保护就没戏了。苹果关于存储的说明。