如何擦除,清除,擦除HTML 5 localstorage为iPad上保存到主屏幕的Web应用程序? [英] How to erase, clear, wipe HTML 5 localstorage for a web app saved to home screen on an iPad?

查看:125
本文介绍了如何擦除,清除,擦除HTML 5 localstorage为iPad上保存到主屏幕的Web应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有关于localstorage如何在iOS 6中运行的精细摘要:

There is a fine summary of how localstorage works in iOS 6 here:

http://blog.nsbasic.com/2012/09/important-io6-and-data-storage/

很多人似乎都担心safari和网络应用程序不共享本地存储等等。但是,我似乎无法在标题中找到问题的答案任何地方

Many seem to be concerned by the fact that safari and web apps do not share localstorage etc.. However, I can't seem to find the answer to the question in the title anywhere:

我的情况:我正在开发一个支持web-app的HTML5网络应用程序,并希望它能够从主屏幕运行。一切似乎都运行良好,但对于开发,我需要能够偶尔清除缓存。我已经尝试了我能想到的一切(以及任何可以想到的组合和序列...):

My situation: I am developing a HTML5 web app with web-app-capable and want it to be able to run from the home screen. Everything seems to work fine, but for development, I need to be able to clear the cache once in a while. I have tried everything I could think of (and any thinkable combination and sequence of them...):


  1. 清除Safari缓存

  2. 从家中删除应用并重新加载

  3. 在将网页保存到主页之前反复重新加载网页

  4. 清除应用程序内的缓存( localStorage.clear()

  1. Clear Safari Cache
  2. Delete app from home and reload it
  3. Reload the web page over and over before saving it to home
  4. Clearing the cache (localStorage.clear()) from within the app

什么你的想法是什么?

推荐答案

你可以使用这个功能来清除localStorage。

You can use this function to clear the localStorage.

localStorage.clear()

您可以添加计数器存储在localStorage中并执行类似的操作。

You can add counter to be stored in localStorage and do something like this.

onload:

 localStorage.reloadCount = localStorage.reloadCount || 0
  //make sure its not undefined
 localStorage.reloadCount = localStorage.reloadCount*1;
  // it stores in string values
 if(localStorage.reloadCount>4)
    localStorage.clear()

这篇关于如何擦除,清除,擦除HTML 5 localstorage为iPad上保存到主屏幕的Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆