Intentional Blocking of Bookmark Navigation

TiG
TiG
@tig
7 years ago
184 posts
Would someone please explain the purpose behind blocking bookmarks in jrFollowMe_init()?

$(document).on("click", 'a', function(e)
{
var aurl = $(this).attr("href") || "";
aurl = aurl.replace(" ", "-");
if (aurl.indexOf("javascript") >= 0 || aurl == "" || aurl.indexOf("#") == 0) {
e.preventDefault();
return false;
}
});

I must allow users to navigate using bookmarks. I can easily address this of course, but would like to know the reason for this code to mitigate side-effects.


--
TiG

updated by @tig: 11/19/17 07:54:08PM
nate
@nate
7 years ago
911 posts
That code prevents the page from jumping back to the top if the url is a hashtag #. Fortunately there aren't many links that use it anymore, so you can remove it. If you encounter a link that is only # you can just remove the href property.
updated by @nate: 08/21/17 05:25:54PM
TiG
TiG
@tig
7 years ago
184 posts
@nate - Thanks for the reply. Bookmarks links are very useful so it was odd to see them disabled. Had to ask.


--
TiG

Tags