Hi all,
Has anyone come across the below, and if so found a fix?
I have section markers within my pages so visitors can skip to sections of a page without having to scroll.
Within a page I would have any number of these:
<a name="<?php echo $i2++; ?>"></a>
If I choose to link from page A to page B by providing the link address to page B followed by #<section number> so for example: <a href=“link url#1”>link anchor text</a> then this will work fine in Chrome, Firefox and Opera but not in IE7 or IE8 and neither will it work in Safari.
Both IE7 + IE8 and Safari will link to and render the requested page but they seem to delete the #<section number> from the link url when processing this request. The user is just shown the top of the page instead of being taken directly to the right section.
Anything to solve this?
Thank you,
So, none of you have ever experienced this issue then? Odd…
Can name attribute values begin with a number? I thought that was buggy at best. Maybe try prepending an underscore or letter.
Thanks for your suggestion. I put a S in front of all the numbers so it’s now S1, S2, S3 etc.
Still doesn’t work in IE or Safari, just ignores the section markers.
Will try ID’s now (instead of names). Hmmm.
UPDATE
Well, neither id or name work, both the below aren’t respected by IE/Safari:
<a id=“<?php echo “S” .$i2++; ?>”></a> …(yields S1, S2 etc.)
<a name=“<?php echo “S” .$i2++; ?>”></a> …(yields S1, S2 etc.)
Nope. No matter what I try IE/Safari won’t budge while the other browsers (Chrome, Firefox & Opera) work fine.
What strikes me is not only that IE/Safari don’t navigate to the desired page section but also strip the #<section name> away from the page url. Maybe that’s why they don’t navigate, if so why strip the page section?
www.myurl.com/page.php#1, www.myurl.com/page.php#S1, www.myurl.com/page.php#s1, www.myurl.com/page.php#ssssss automatically becomes www.myurl.com/page.php in IE/Safari. It’s not Apache because then the other browsers would fail too.
Little things like this…goodness me.
Maybe I should point this out (just to be clear). The problem only occurs when linking for one page on my website to another page on my website and the latter has a section name appended to it i.e. “#section-name”.
Internal hyperlinks within the same page work fine. IE/Safari just have a problem of passing a url to a different page with a section name appended to it.