开发者

Javascript clear local data

Is there a way to clear all of my application's local data with javascript?

I would like to clear:

Session Storage
Cookies
Local Stor开发者_C百科age
Application Cache (html5 spec)


Think you would have to deal with each individually as each browser would implement differently.

sessionStorage.clear

localStorage.clear

and for cookies there is already a good answer on SO

You could of course just put these into your own function.

If the application cache is server side you could have an ajax call to a http post that deletes this.

UPDATE: it is advised against clearing application cache, http://www.whatwg.org/specs/web-apps/current-work/#expiring-application-caches. What would you be storing there that you would want deleted?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜