0

I have a simple horizontal tab-list containing 4 tabs. The correct content is loaded, when it's associated tab is clicked, but...

when I referesh the page, the selected tab will default back to the first tab in the row, which is undesireable.

So, how can I save the open tab across page loads? I read somewhere, that the cookie-method is deprectated in jQuery.

Now, am I to use local storage? And if so, how does it work?

Thanks! :)

shyko
  • 3
  • 1
  • cookie deprecated in jQuery?! Any ref because doesn't make much sense, cookie being a browser's feature. I guess you have read that: http://stackoverflow.com/questions/14313270/jquery-ui-tabs-no-longer-supporting-cookie-now-what – A. Wolff May 05 '14 at 10:06
  • Thanks, I'll look into that! http://jqueryui.com/upgrade-guide/1.9/#deprecated-cookie-option – shyko May 06 '14 at 11:24

1 Answers1

1

Web storage will be the better option if you don't want to use cookies. You can get webstorage examples here : http://www.w3schools.com/html/html5_webstorage.asp

K K
  • 17,794
  • 4
  • 30
  • 39
  • Awesome, thanks for pointing me in the right direction. I got it working like this: http://codepen.io/anon/pen/aDbFr Any advice on how to optimize my code is very welcome. I'm an absolute beginner! ;) – shyko May 06 '14 at 13:13
  • Modified your code a little bit : http://codepen.io/anon/pen/HdJso . You can then mark it as an answer if it worked for you – K K May 06 '14 at 13:23
  • Thank you! I'm all set for now. :) – shyko May 06 '14 at 14:38