ProfK
ProfK

Reputation: 51064

How can I maintain state in browser JavaScript across different page loads from the same site?

I need to do something very simple, i.e. maintain which panel bar item is highlighted, across different page loads. I'm using this as a menu, and it looks good with the selected menu item highlighted as soon as I click it, when when the link (page) for that menu item returns, the menu is reloaded and I lose this.

I don't really want to use ajax calls to manage session variables just for this if I can keep in local, but where else can I store this menu state?

Upvotes: 0

Views: 1681

Answers (1)

Quentin
Quentin

Reputation: 943537

Cookies, local storage or you can encode the data in the URIs you link to (e.g. in the fragment identifier).

Upvotes: 4

Related Questions