SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    Now available in Orange Tijmen's Avatar
    Join Date
    Jul 2004
    Location
    The Netherlands
    Posts
    1,472
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    bottom anchor not working in IE6?

    I'm working on a website where they want to have the option to go to the bottom and top of the page by just clicking on the "top" and "bottom" link.

    The top one works fine in IE6, its just the bottom link that just doesn't work at all. Any idea why that is?
    Travel Photos on Flickr - Twitter

    “Never give up. Never surrender”

  2. #2
    SitePoint Guru alecrust's Avatar
    Join Date
    Jun 2007
    Location
    London, UK
    Posts
    728
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes the reason for this is because it ignores the id="" part. To cut a long story short, some browser don't support it so to make it cross-browser you must add name="" in addition.

    Not only that, but you only need the #top part, not test.html#top.

    So replace:
    Code:
    <a href="test.html#bottom">bottom</a>
    With:
    Code:
    <a href="#bottom">bottom</a>
    And then replace:
    Code:
    <a id="bottom"></a>
    With:
    Code:
    <a id="bottom" name="bottom"></a>
    Honda Civic Forum - UK Civic Forum
    Web Host Reviews - Independent, honest host reviews
    My Portfolio - Simplicity is the ultimate sophistication

  3. #3
    Now available in Orange Tijmen's Avatar
    Join Date
    Jul 2004
    Location
    The Netherlands
    Posts
    1,472
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by alecrust View Post
    Yes the reason for this is because it ignores the id="" part. To cut a long story short, some browser don't support it so to make it cross-browser you must add name="" in addition.
    Are you sure that adding the name="" should fix it? I try'd it here at several computers in IE6 and it didn't work anywhere. I first had just the name, and replaced that with the ID. But having them together doesn't work seem to work in IE6 either.
    Travel Photos on Flickr - Twitter

    “Never give up. Never surrender”

  4. #4
    SitePoint Guru alecrust's Avatar
    Join Date
    Jun 2007
    Location
    London, UK
    Posts
    728
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It should. Can you update your page with what I have suggested and I'll take a look.
    Honda Civic Forum - UK Civic Forum
    Web Host Reviews - Independent, honest host reviews
    My Portfolio - Simplicity is the ultimate sophistication

  5. #5
    Now available in Orange Tijmen's Avatar
    Join Date
    Jul 2004
    Location
    The Netherlands
    Posts
    1,472
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by alecrust View Post
    It should. Can you update your page with what I have suggested and I'll take a look.
    The updated page is online
    Travel Photos on Flickr - Twitter

    “Never give up. Never surrender”

  6. #6
    SitePoint Guru alecrust's Avatar
    Join Date
    Jun 2007
    Location
    London, UK
    Posts
    728
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Interesting. I don't have time to test I'm afraid, but that should work.

    Have you tried:
    Code:
    <a id="#bottom" name="#bottom"></a>
    Honda Civic Forum - UK Civic Forum
    Web Host Reviews - Independent, honest host reviews
    My Portfolio - Simplicity is the ultimate sophistication

  7. #7
    Now available in Orange Tijmen's Avatar
    Join Date
    Jul 2004
    Location
    The Netherlands
    Posts
    1,472
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by alecrust View Post
    Interesting. I don't have time to test I'm afraid, but that should work.

    Have you tried:
    Code:
    <a id="#bottom" name="#bottom"></a>
    Yeah, its really weird that it doesn't work in IE6, I really don't get it. Adding the # doesn't work either...
    Travel Photos on Flickr - Twitter

    “Never give up. Never surrender”

  8. #8
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code HTML4Strict:
    <body>
      <p><a href="#bottom">Link</a>...</p>
      ...
      <p id="bottom">...</p>
    </body>
    This 'works' in IE6 inasmuch as it scrolls to the bottom of the page. The problem is that keyboard focus is not transferred, so if you hit Tab it will go to the next link or form control after the one at the top.

    The only way to make this work in IE6, AFAIK, is if the target is a link with an href attribute.

    Note that there mustn't be a leading '#' in the ID or the name (it's invalid). The '#' character in the URI indicates the start of a fragment identifier; it's not part of the identifier itself.
    Birnam wood is come to Dunsinane

  9. #9
    Now available in Orange Tijmen's Avatar
    Join Date
    Jul 2004
    Location
    The Netherlands
    Posts
    1,472
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks , it works now
    Travel Photos on Flickr - Twitter

    “Never give up. Never surrender”


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
  •