Use cookies to store session data instead of sessionStorage

This is needed because the Tor Browser Bundle does not support sessionStorage
and localStorage.