Forum Moderators: open

Message Too Old, No Replies

Inserting anchor not working in ff/safari

anchor text doesnt work, firefox safari

         

dems

12:07 am on Sep 28, 2010 (gmt 0)

10+ Year Member



Hello,
So this is a question I have seen written a thousand times but I cannot find a solution, hoping someone has one :)

I have a shopping cart and i would like to jump from the top to the bottom when more colorways exist for each product. It works in IE and Chrome and does not work in Firefox and Safari, can anyone tell me what I am doing wrong or how to correct it?


<a href="#morecol" class="button" style="color:#FFFFFF;" >More Colors</a> 


and it should jump to:

<a name="morecol">&nbsp;</a>
<div class="ProductSubtitle" style="padding:10px; margin-top:10px;">
<h3 id="morecol">{$msg.product.secondary_images}</h3>
</div>


The problem is, as the content is dynamic, I cannot add the page in href,I only specify with #. Just need it to find it's anchor down the page. For example (not sure if i can have links in post,I will write like this):

The link should be:
mysite.com/cart/jewelry/123adb#morecol

in ff/safari, with the above code, the link goes to
mysite.com/#morecol

Thank you!

MichaelBluejay

3:56 am on Sep 28, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your code works fine for me in Firefox and Safari. I click the link, and it jumps down to the anchor. (I did add a 2000-pixel high paragraph after the link in order to give it something to jump to.

dems

4:56 pm on Sep 28, 2010 (gmt 0)

10+ Year Member



Thanks for the reply!

Did what you suggested adding the following (was that what you meant?)
<a href="#morecol" class="button" style="color:#FFFFFF;" >More Colors</a> <p style="height:2000px;"></p>


Can you tell me if it works for you on the real site cuz still not working for me :( (since removed the paragraph height)

< link removed at member request >

click on "more colors" grey button and should drop you to the bottom of the page.

link should take you to same page and #morecol but in safari/ff goes to home page and #morecol because I believe of the dynamic content- how to get these browsers to understand it is on the same page?

[edited by: tedster at 5:22 pm (utc) on Sep 29, 2010]

MichaelBluejay

5:56 pm on Sep 28, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Ah, here's your problem:

<base href="http://shoppingforachange.org/"/>


That tells the browser to start all urls with that address.

In fact, your code has two "base href" declarations, one good and one bad. Take out the bad one and you're fine.

Sometimes being able to see the actual page (and the whole code) really helps. However, that's actually not allowed here on WebmasterWorld, so just a heads up that a mod will remove links you post and ask you not to do that any more.

tedster

5:58 pm on Sep 28, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You've got a number of nesting errors in the mark-up, and these might well be causing confusion. Validate before you try to debug, or you may be infinitely frustrated.

anuseo

11:47 am on Sep 29, 2010 (gmt 0)

10+ Year Member



I agree with Michael there is problem with "base href"...try to recheck the whole website code...

tedster

4:04 pm on Sep 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sometimes being able to see the actual page (and the whole code) really helps. However, that's actually not allowed here on WebmasterWorld

I'm willing to experiment with allowing the links in this case. It seems to be strange enough that visiting the page may be needed to debug. Just a warning - this thread may begin to compete with your own URLs in the rankings ;(

dems

5:18 pm on Sep 29, 2010 (gmt 0)

10+ Year Member



Thanks so much everyone for your replies- helping me out a lot here! Tedster, thank you for allowing me to post the links, now that I am on path to eliminate the issue, can you remove the links? I tried but too much time has past to edit the post now.

The site has only been live for 1 week and since google has only indexed a handful of pages, it doesnt need this one up there with its few pages indexed!

Thanks again everyone!

rocknbil

10:27 pm on Sep 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Name is deprecated for anything but form controls, you could try using an id instead. May not make a difference, but it's the right way, and might even work.

<a id="morecol"></a>

tedster

10:30 pm on Sep 29, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The original code in the first post does have both, name= and <h3 id="morecol">

MichaelBluejay

12:19 am on Oct 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Everyone, I noted the problem long ago: Two conflicting "base href"'s. It's that simple!

MichaelBluejay

12:23 am on Oct 1, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



rocknbil, "name" does *not* appear to be deprecated for anchors, according to W3C [w3.org].

dems

5:07 am on Oct 8, 2010 (gmt 0)

10+ Year Member



My apologies for taking so long to get to this but everything seems more important than the next when a site goes live-

Just wanted to tell MichaelBluejay and Anuseo that you were absolutely correct, removing the base href did the trick! Anchors work like a charm now. Thank you so very much for your input! You really saved me on that one :)