Alasdair McLeay
Alasdair McLeay

Reputation: 2632

Clear localStorage on iOS Safari

How can you clear all localStorage on iOS Safari? Selecting 'Clear history and website data' does not remove localStorage (which seems odd, possibly a bug?).

A similar question was asked on apple.stackexchange.com but was closed.

I have recorded a video showing the issue in the iOS9.1 simulator.

Upvotes: 10

Views: 36000

Answers (3)

Rich Finelli
Rich Finelli

Reputation: 907

So as you're seeing some browsers are more stubborn about keeping the local storage than others. One thing you can do is clear the storage using the localStorage API.

localStorage.clear() //clears everything in localStorage
localStorage.removeItem("test123") //removes only the specific property "test123"

I wrote this article about localStorage, that explains some of the nuances.

I'm not sure how to clear it manually in iOS.

Upvotes: 10

Subbu
Subbu

Reputation: 133

You need to clear the respective db files at /Library/Safari/Databases and /Library/Safari/LocalStorage

Open the Finder in your Mac and click on GO and Go to Folder and paste the above two locations.

Delete the files which have the names of the applications whose data you want to clear.

Upvotes: -1

Jan Swart
Jan Swart

Reputation: 7221

From Apple Support:

To clear other stored information from Safari, tap Settings > Safari > Advanced > Website Data > Remove All Website Data."

Or, if you want to delete it for a specific site, you can either slide the entry to left and delete it, or you can press edit in the top left and delete what you have to.

Upvotes: 14

Related Questions