The onhashchange event is exactly named, it fires only when the hash changes.
The only solution I know of for this problem is to associate the same function with the event of a click on the icon of the main page.
In addition, jQuery provides its own event for changing the hash:
$(window).on("onhashchange", function (e) { route(); }) $(".icon").on("click", function(e) { location.hash == "#/" ? route(): null; })
Also, if these are tags, say in the #nav div:
$("#nav").delegate("a", "click", function () { location.hash == this.href ? route() : null; })
Or it can be applied to all tags:
$("a").on("click", function () { location.hash == this.href ? route() : null; })
source share