What is it called when a navigation link (<a href="#">
) has a hash as placeholder without a landing page?
2 Answers
It's called a fragment URL or fragment identifier, although it's also known as just fragment, anchor or hashtag anchor
Take this URL:
www.example.com/foo.html#bar
The URL fragment of this URL is #bar
. The main purpose it can serve is to link to particular part of the page, so that when the user opens this page, the browser will scroll to that part of the page automatically.
The link <a href="#">...</a>
is linking to the current page with URL fragment set to empty. It's not really a placeholder URL, it does have an effect. If the current page URL displayed in the expanded address bar in the browser is http://example.com/#foobar , then clicking on the link <a href="#">...</a>
will change the URL to http://example.com/# . It won't cause the page to reload, because only the URL fragment changed.
People use it as a placeholder URL, because setting the href
to empty often doesn't have the desired effect.