3

I've been pulling my hair on a tiny thing: https://numa.co/about/#corporate-innovation

This URL doesn't go to the right anchor, only in Chrome and I can't see why... It works in our development environment. The only difference I can see is that we're behind Cloudflare in production and it's HTTPS. I can't see how this would make a difference though.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Alb Dum
  • 1,121
  • 3
  • 11
  • 26

3 Answers3

2

This is a workaround to your problem and works fine in all major browsers.

Put this JavaScript code in head section of the page where your anchor is.

<script>
window.onload = function() {
    if(window.location.hash) {
       elmnt = document.getElementById(window.location.hash.substring(1));
           elmnt.scrollIntoView(true);
    }
}
</script>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Zbigniew Ledwoń
  • 682
  • 1
  • 6
  • 19
1

You have two elements with the same id="corporate-innovation". The browser is going to the first of those elements. id's must be unique to one element. Check the spec.

Jacob
  • 2,212
  • 1
  • 12
  • 18
0

It looks like the a name is empty to me. This needs to be the same as the URL fragment. Take a look at this view of my inspector: https://i.stack.imgur.com/Z9JD3.jpg

You might need to take a look at the original HTML to see if there's an issue with syntax. The inspector on the image is Chrome on Mac.

I would try to change the HTML to be more like this:

<a name="corporate-innovation"></a>
<h3 style="color:#E50064">Corporate Innovation</h3>
<span style="color:#E50064"><p>NUMA helps corporates innovate in a different way by collaborating with an ecosystem of entrepreneurs and experts. We provide new methodology training, accelerated intrapreneurship projects, and create open innovation programs for large companies and public institutions.</p>
</span>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • I've put that just as a test, I'm falling back to the

    because it's the regular html5 way if you don't need an anchor (http://stackoverflow.com/questions/484719/html-anchors-with-name-or-id) But it really looks like there's something extra that is happening on chrome on mac, that should be very straightforward

    – Alb Dum May 11 '16 at 08:18
  • Yeah i thought it looked a little bit like there was a missing " somewhere and Chrome was trying to compensate for it somehow! – Jamie Buttons Coulter May 11 '16 at 08:45