Results 1 to 8 of 8

Thread: Tab Content Script Errors

  1. #1
    Join Date
    May 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Tab Content Script Errors

    The Tab Content Script gives error in IE6 when a tab is selected before the page finishes loading.

    Is there a way to prevent this?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Four possibles right off the top of my head:

    1) Don't click on the tabs until the page is loaded.
    2) Get a faster connection to the internet.
    3) Don't load so much content onto your page that it takes so long to load in the first place.
    4) Hide the tabs until after the page and its script are loaded.

    This last one may require explanation, let me know. Gotta run.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    May 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you, jscheuer1 for your quick reply

    I will try to improve the speed of the page load.

    But I definitely would like your explanation for #4!


    ---

    >> 4) Hide the tabs until after the page and its script are loaded.

    >> This last one may require explanation, let me know.

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Hmmm I'll take a closer look at the script tomorrow, and if there in fact is a bug, post a fix. Note that the tabs definitely cant respond until the page finishes loading due to the way it's designed, but there shouldn't be an error when a user tries to click on the tabs before this is so.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I was just setting up the demo for this script to make an example of hiding the tabs until the page and script were loaded. My idea was simple enough, set visibility to hidden until the script loads. I figured I'd use the script without the optional persistence feature, just to simplify things. However, without the persistence module I was getting an error:

    Quote Originally Posted by IE6
    persisttype is undefined
    It was referring to this line in the code:

    Code:
    var cookiename=(persisttype=="sitewide")? "tabcontent" : window.location.pathname
    in the function do_onload()

    From working with other DD scripts that have this persistence feature, I knew right away that either this function or a part of its code did not belong in the non-persistence enabled version I thought I was creating. Are you using the persistence module? If not, adding it will probably take care of the error. I added it and the error disappeared. There will need to be a rewrite of the non-persistence version and the persistence 'module' as the code is not properly portioned out between the two, together they seem to work fine.

    Now, if you were using the persistence feature and still getting an error. And if this error only happens while the page is loading and NOT after the page is loaded, this should take care of it. Add this before the style section:

    Code:
    <script type="text/javascript">
    if (document.getElementById)
    document.write('<style type="text/css">#tablist{visibility:hidden}</style>')
    </script>
    and add these two lines:

    Code:
    if (document.getElementById)
    document.getElementById('tablist').style.visibility='visible'
    right after this line:

    Code:
    expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
    If the problem is due to load time, this will take care of it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    May 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Solved!

    Your fix works like a charm.

    Thanks John!

    ---

    Now, if you were using the persistence feature and still getting an error. And if this error only happens while the page is loading and NOT after the page is loaded, this should take care of it. Add this before the style section:

    Code:
    <script type="text/javascript">
    if (document.getElementById)
    document.write('<style type="text/css">#tablist{visibility:hidden}</style>')
    </script>
    and add these two lines:

    Code:
    if (document.getElementById)
    document.getElementById('tablist').style.visibility='visible'
    right after this line:

    Code:
    expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
    If the problem is due to load time, this will take care of it.[/QUOTE]

  7. #7
    Join Date
    May 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Oops! Persistence is lost with fix

    I replied too quickly. The original pdroblem is solved, but now the persistence feature doesn't work anymore.

    Help?

    Thanks again!

    ---
    [QUOTE=himalayansnowboarder]Your fix works like a charm.

    Thanks John!

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Um er, that is not caused by our modifications. The persistence feature works off of the display style not the visibility style which I used for our modification. More than likely you recently switched persistence from local to sitewide or vice/versa or from on to off or just were adjusting it in general. I tried this and it threw things off for awhile until the cookies got caught up with what was happening. My suggestion is just set it the way you want and forget it, in a few days it should work fine for you. Less frequent visitors to your site will not have the problem, as their cookies have expired if, in fact they had any to begin with.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •