Use localStorage instead of cookies.

But maintain compatibility with the previous storage method (cookies)
in case someone has already stored in cookies. Will eventually remove
it, however.