When Hash(#) Link Pressed In Some Websites, Does Not Add Hash To Url?
I have hash(#) links in my own website, and I realised that when I click on them, a hash sign will always appear at the end of my url. But in other web pages that I was fiddling ar
Solution 1:
They probably have javascript attached to the link that prevents the link action from starting.
A simple
returnfalse;
will do this
Solution 2:
It's normal behaviour of anchor links. If you click link with href like something#anchor
, you are redirected to url something
(if you aren't already on it) and #anchor
appended to url. This anchor refers to some part of page. Single "#" sign is simply the empty anchor.
To avoid this sign appearing in url, you should remove href
attribute entirely (but sometimes after this action you need to fix stylesheet because appearance of links depends on href attribute presence). Or, if you are using javascript handlers of click event, you should change them to return false.
Post a Comment for "When Hash(#) Link Pressed In Some Websites, Does Not Add Hash To Url?"