Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
261 views
in Technique[技术] by (71.8m points)

javascript - Where in the filesystem does IE8 store values stored in localStorage?

My organization is starting to use this feature and for testing it would be ideal if we could find and delete these values as well as see what's written to disk, but I can't figure out where IE8 is storing them. I found the .sqlite files in

AppDataLocalApple ComputerSafari for Safari and AppDataRoamingMozillaFirefoxProfiles yb7f27l.defaultwebappsstore.sqlite for FF3.5

Any help on IE8 would be appreciated!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The location of local storage on the file system is most likely an implementation detail that is not guaranteed to always be the same from version to version (it could even change with a service pack or update to IE).

To clear local storage using the approved methods, see Clearing the Storage Areas on the Introduction to DOM Storage MSDN page:

Clearing the Storage Areas

Session state is released as soon as the last window to reference that data is closed. However, users can clear storage areas at any time by selecting Delete Browsing History from the Tools menu in Internet Explorer, selecting the Cookies check box, and clicking OK. This clears session and local storage areas for all domains that are not in the Favorites folder and resets the storage quotas in the registry. Clear the Preserve Favorite Site Data check box to delete all storage areas, regardless of source.

To delete key/value pairs from a storage list, iterate over the collection with removeItem or use clear to remove all items at once. Keep in mind that changes to a local storage area are saved to disk asynchronously.

An alternative to using the approved methods is to use a tool like Process Monitor to watch disk and Registry accesses while you write something to window.localStorage. Unfortunately, if you see it writing to a file like %userprofile%Cookiesindex.dat it would probably be unwise to delete that file (since it contains information about all the other cookies IE knows about).

EDIT: Using my own suggestion I found that local storage seems to be at %userprofile%Local SettingsApplication DataMicrosoftInternet ExplorerDOMStore (in Windows XP, Vista and Windows 7 will be slightly different). They are just XML files but I'm not sure how safe they are to delete because of the index.dat (which may retain information about the existence of the XML files or their contents).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...