开发者

How to remove HTML5 persistant databases in UIWebView?

开发者 https://www.devze.com 2023-03-16 18:51 出处:网络
I have a native application that uses a UIWebView and notice that with sites like Google, they are using an HTML5 local database for storing information.I am using native APIs for clearing items out o

I have a native application that uses a UIWebView and notice that with sites like Google, they are using an HTML5 local database for storing information. I am using native APIs for clearing items out of the cookie store, but clearing the persistent cookie store does nothing to remove these local databases. Is there a way to remove them through a native API?

U开发者_运维知识库PDATE:

Is there a way to do this through a non-native API or javascript?


You can run this JavaScript directly in your url bar:

javascript:localStorage.clear();

Note that local storage is same domain scoped, so it will clear the storage of the current domain that you are.

Currently google uses it for google Analytics, adSense, etc.


You can remove all localstorage variables by using a function like this.

function clearStorage() {
  for(var i in localStorage)
  {
    localStorage.removeItem(i);
  }
}

Of course if you need to only get rid of certain variables or simply set them to default values types then this will have to be modified. I am not familiar enough with UIWebView or your use case to know which variables you would want removed.

0

精彩评论

暂无评论...
验证码 换一张
取 消