Tabbed Content / Posts /

data-persist issue with Tab Content

5
Hi,
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  11 years ago   viewed: 8623    

11 Answers

0
Then why not setting data-persist="false"?
Yes setting it true will write the cookies.
Milo   11 years ago
0
hi.
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   11 years ago
0
how to clear the cookies on logout?
jack   11 years ago
0
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=/";
Milo
  11 years ago
0
HI

I placed your code in logout file but still no success... or I have to change something in your code?
Jack   11 years ago
0
You need to run the script after you logout action.
Milo   11 years ago
0
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   11 years ago
0
Then please try Menucool McTabs as it has a built-in select function, e.g.
 tabbers[0].select(0, false);
Milo   11 years ago
0

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.

Steve
  9 years ago
0
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
  5 years ago
0

Please read the Set Persistence section under the "How to Use" tab in http://www.menucool.com/tabbed-content

Milo
  5 years ago

   

Your name*
Password
(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: