Tabbed Content / Posts /

data-persist issue with Tab Content

thanks for superb tab control.

I am showing tabs after user login. I have 5 tabs. if user clicks the 5th tab and logout but doesnt close the browser and when he login back he will see the 5th browser again because of data-persist='true'. I cannot reduce the use of data-persist='true'.
I need to show the first tab on every login, which I have done though PHP

But when user refreshes the page he gets the tab which was opened before logout because of data-persist='true'

is data-persist='true' writing something into the cookies. if yes how to clear them on logout

any help will be highly appreciated.
Jack  9 years ago   viewed: 8216    

11 Answers

Then why not setting data-persist="false"?
Yes setting it true will write the cookies.
Milo   9 years ago
I already said I cannot reduce the use of data-persist="true" because I am using form inside tabs which when get submitted I need to show same tabs
jack   9 years ago
how to clear the cookies on logout?
jack   9 years ago
Please try running the following javascript to change the cookie value of current index to 0:

    function generateCookieKeyName () {
        var paths = window.location.pathname;
        if (paths.indexOf('/') != -1) paths = paths.split('/');
        var name = paths[paths.length - 1] || 'root';
        if (name.indexOf(".") != -1) name = name.substring(0, name.indexOf("."));
        if (name > 20) name = name.substring(name.length - 19);
        return name;

document.cookie = "mi"+generateCookieKeyName() + "0=0; path=/";
  9 years ago

I placed your code in logout file but still no success... or I have to change something in your code?
Jack   9 years ago
You need to run the script after you logout action.
Milo   9 years ago
No Dear its not working. Still on refresh after login I get the same tab which I left open before logout

kindly look into this matter. I hope to get a help from your side
Jack   9 years ago
Then please try Menucool McTabs as it has a built-in select function, e.g.
 tabbers[0].select(0, false);
Milo   9 years ago

I had the same problem but it's easy to fix.

Just remove "data-persist=true"

The tabs still work fine but it doesn't create a persistent cookie, so on refresh it goes back to first tab.

  7 years ago
Thanks a lot Steve!
I had to know what is the purpose of using "data-persist=true".
After spending some important time I found this.
Muhammad SH
  4 years ago

Please read the Set Persistence section under the "How to Use" tab in

  4 years ago


Your name*
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: