HTML5 storage and Chrome

I want to create a standalone application. I would like to know how cache clearing works in Google Chrome. If a user deletes his cookies, will his offline content disappear?

+5
source share
3 answers

I am running Chrome v 5.0.370. When I execute “Delete cookies and other site data” from the “Clear browsing data” dialog box, localStorage is actually destroyed.

Now, to be literal, if a user launches Webkit Inspector, opens the Storage tab and only deletes cookies, and localStorage will not be affected.

But I suppose that you mean through the usual dialogue.

+4
source

19 . ccleaner yest, webStorage - ( , chrome).

+2

Yes We can store a variable declaration in local storage, for example, a session variable. and you can use it for future use.

Cm

interface Storage {
  readonly attribute unsigned long length;
  [IndexGetter] DOMString key(in unsigned long index);
  [NameGetter] DOMString getItem(in DOMString key);
  [NameSetter] void setItem(in DOMString key, in DOMString data);
  [NameDeleter] void removeItem(in DOMString key);
  void clear();
};

I will give you an example:

// Save data to the current session store
sessionStorage.setItem("username", "John");

// Access some stored data
alert( "username = " + sessionStorage.getItem("username"));

The sessionStorage object is most useful for temporarily storing temporary data that needs to be saved and restored if the browser is accidentally updated.

// Get the text field that we're going to track
 var field = document.getElementById("field");

 // See if we have an autosave value
 // (this will only happen if the page is accidentally refreshed)
 if (sessionStorage.getItem("autosave")) {
    // Restore the contents of the text field
    field.value = sessionStorage.getItem("autosave");
 }

 // Listen for changes in the text field
 field.addEventListener("change", function() {
    // And save the results into the session storage object
    sessionStorage.setItem("autosave", field.value);
 });
0
source

All Articles