Passing javascript variables between pages [duplicate]

There are two obvious ways to maintain state in the browser without requiring that the server remember it between pages:

  1. Cookies

  2. localStorage

The latter is trivial to implement, but is only available in HTML5.

Note that neither is intended to be secure – a determined page hacker could set either to whatever value they wish.

Leave a Comment