Does localStorage.clear (); to clear EVERYTHING from the PC?

If I call the following:

window.onbeforeunload = function() {
  localStorage.clear();
};

      

Does this mean all local storage from the user's computer or just what my site installed?

+3


source to share


1 answer


From the specification forclear

:

The clear () method must atomize so that the list associated with the object is cleared of all key / value pairs, if any. If they are not there, then the method should not do anything.

The above "object" in this context would be localStorage

. What is it localStorage

? From the specification :



The localStorage object provides a storage object for the source.

So it will just clear the data for your origin or domain.

+3


source







All Articles