0

Pretty straightforward link coding inside a Wordpress site:

<div class="block_level">
    <a class="generic_class" id="unique_identifier" href="http://www.example.com/sub_dir/page_name#unique_identifer" target="_self">Link Text</a>
</div>

The link fires and loads http://www.example.com/sub_dir/page_name#unique_identifer into the address bar. The page loads but doesn't move down to the id location.

If at that stage you cut and paste the address into a new window, it loads the page and moves down to the id location as it's supposed to. So it's not like the id isn't there, or there any issues with it. When I do this my browser adds a backslash just before the # in the address bar; not sure if that's relevant: http://www.example.com/sub_dir/page_name/#unique_identifer

I've tried amending the link to include that backslash, which it pulls through fine, but it still doesn't move down to the id location on page load.

NOT A CLUE why it would be acting like this; any ideas??

Paul
  • 1
  • 2
  • In theory, it shouldn't make a difference, but have you tried removing the `target="_self"` from your tag? – nibnut Jan 19 '17 at 20:19
  • Try to url encode first http://stackoverflow.com/questions/5007352/how-to-escape-hash-character-in-url?noredirect=1&lq=1 – Nikos Js Jan 19 '17 at 20:47
  • Removing `target="_self"`has no effect. Encoding the # in the url just returns a 404 :/ – Paul Jan 19 '17 at 21:06
  • Changing to `target="_blank"` _does_ work. If the link is forced to open in a new window, it moves down to the anchor correctly. But that's not the point! – Paul Jan 19 '17 at 21:32
  • Should add, it's a **Wordpress** site using the **Bridge** theme, which operates a slide out - slide in page transition. That transition is the only difference I can think of between opening a new browser window and staying in the same one. Could that be having a negative effect on the go-to-anchor functionality? – Paul Jan 19 '17 at 21:42
  • Turned of the page transitions and all works fine. – Paul Jan 20 '17 at 11:43

0 Answers0