- Session storage.
- Local storage
- Database storage
Session storage: This is more like a upgraded version of a cookie. It persists only during browsing and once window is closed data is lost. This is easy to implement.
sessionStorage.setItem('shoppingId', '23234')alert("Shopping Id is: " + sessionStorage.getItem('shoppingId'));//same thing could also be achieved with sessionStorage.shoppingId//to removesessionStorage.removeItem('shoppingId');