The anchor works with the name attribute in <a>
tags, not with a <div>
.
The link:
<a href="page.html#here>
to link to another page's specific div.
</a>
The target destination:
<a name="here">
stuff
</a>
If you are trying to mess with this behavior using jQuery (e.g. prevent it via javascript in the target page), then there is a problem because the browser loads the page FIRST and THEN runs the javascript in the page so unless the default condition of your destination page is hidden, the content may show one way before the jQuery can modify it. Unless you can initially hide the target page with static CSS style rules (not with javascript), there isn't anything you can do about this because the page may show before your javascript runs.
If you can put javascript in the first page, you could remove the #here
from the links so when they are clicked, they don't have that extra target in them.
If you can modify the HTML of the second page, you can remove the name
targets so the #here
doesn't do anything.