1

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

I would like to clear:

Session Storage
Cookies
Local Storage
Application Cache (html5 spec)
Lee Quarella
  • 4,662
  • 5
  • 43
  • 68

1 Answers1

2

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?

Community
  • 1
  • 1
dove
  • 20,469
  • 14
  • 82
  • 108
  • Application cache is part of html5 spec. It is all stored locally and I have not found anything talking about deleting it programmatically (plenty about updating and reloading it though). – Lee Quarella Jul 14 '11 at 21:53