0

Here's a question i'm finding hard to answer with google and seem to be having problems with it on my site.

I am encoding/decoding user id's just to confuse matters and would like to link to parts of a page using anchors

Thing is.. My encryption is making a nice secure long string but I think there must be a limit to the length of the # anchor names because it works when its shorter, but not when its longer.

Does this seem to be true?

An example of the hash tag url is http://wgwegw.co.uk/wegweg/protected/view-game/wegweg/platform#x243j3f41684w2w2m594n416

For example i have a link:

<a href="http://*.co.uk/*/protected/view-game/*/platform#y213j3f41684w2w2m594n416">Go to comment</a>
  1. When i click on it.. it opens up using HTACCESS file redirects. if i use javascript window.hash it returns the hash so i imagine the hash code is not affected by the htaccess redirects.

  2. I land on the page: http://.co.uk//protected/view-game/*/platform#y213j3f41684w2w2m594n416

On that page in html is an anchor name: <a name="y213j3f41684w2w2m594n416"></a>

It does not skip to that part of the page?

Jimmyt1988
  • 20,466
  • 41
  • 133
  • 233

1 Answers1

0

OK here you go.

You won't believe this but I have suffixed an 'a' and now it works.

What on earth?

EDITED//

Could it be because i have an id and a name that equal the same? so i have a

<div id = "y213j3f41684w2w2m594n416"> 

and I have a

<a name = "y213j3f41684w2w2m594n416" />

So when i attach a to the end of the name.. it no longer is the same as the id and thus doesn't get confused?

EDITED//

If I try this on W3 example tweaks it still works so it can't be that? Aghh now it's fixed i am desperate to know why it's working.

Jimmyt1988
  • 20,466
  • 41
  • 133
  • 233
  • This makes no sense.. if you goto W3.. their example has a number at the end and it works... However putting the a at the end definitely made it work for me – Jimmyt1988 May 28 '12 at 13:21
  • It is most likely the duplicate and it's probably going to the `div`, which I expect is close enough to your current location that you're not able to notice the jump; the browser is going to have to arbitrarily pick between them somehow, and it might be picking based on a lot of factors. Also, if your link is for the same page, then you don't need to put anything more than the hashtag. – pickypg May 28 '12 at 13:37
  • I have a view comments page, then u click on the comment and it takes you to where the comment was in another page just by the #tag... I have approximately 25 comments on this page each one has a and also for each one a
    I'd agree with you straight off but I can't get that same error when I do some test html page set ups in w3 edit code sections
    – Jimmyt1988 May 28 '12 at 13:40
  • Whether or not you can easily reproduce it, why bother using the anchor when you have the containing div with the same name? If the div is good enough (not too low), then use that and remove the anchor. If the div is not good enough, then add something unique to the div's id (e.g., id = hash + "+comment"). – pickypg May 28 '12 at 14:18
  • Absolutely. Thanks for your time mate. It's a great idea and one i hadn't thought of. Alas, it seems this adding 'a' onto the end seems to make it work. I guess I'll stumble across this problem another time and it will be more evident as to wtf is going on haha. – Jimmyt1988 May 28 '12 at 17:11