HTML and CSS Reference
In-Depth Information
Figure 7-4.
The
storage
event is raised when a key is added.
Clearing Web Storage Manually
If you add key-value pairs to
localStorage
and then close the browser without clearing the storage area,
the data is preserved on the disk. As mentioned earlier, unlike cookies, you can't set a specific expiration
date and time for local storage. One way to clear the
localStorage
data is to programmatically call the
removeItem()
method for each item or call the
clear()
method. Alternatively, you can manually delete the
localStorage
data using browser dialogs. For example, Figure 7-5 shows the Clear All History dialog in
Firefox.
Figure 7-5.
Clearing local storage manually