You can use the Web Storage API from HTML 5, which is already largely compatible with almost every browser around, as you can see here: Web Storage Compatibility
WebStorage
and SessionStorage
can be used exatcly like a cookie, storing key/value
pairs, but have the advantage that they are not sent back and forth from your server to the client, but are instead stored on your mobile.
More over, they are really easy to use, as much as this:
if ( typeOf(Storage) !== "undefined" ) {
localStorage.setItem('some_key','some_value')
var myVal = localStorage.getItem('myKey')
}
However, you should use a more sofisticated check in production (e.g. Modernizr)
As their names suggest, the SessionStorage is emptied on the end of the current session, while the LocalStorage is persistent through the sessions.