Javascript examples for Browser Object Model:Window localStorage
Removing localStorage entries
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*w w w . j a v a 2 s . com*/ var foo = localStorage.getItem('foo'); if (foo) { console.log('i had it, now i remove it'); localStorage.removeItem('foo'); } else { console.log('i didnt have it, now i set it'); localStorage.setItem('foo', 'bar'); } } </script> </head> <body> </body> </html>