I placed a script tag at the end of a html page:
$(window).on ('hashchange', function (e) { alert (location.hash); });
It works if I click on buttons with hrefs like #a, but If I open links like localhost/aaa#a the alert function is not triggered.
So it looks like I have to detect the presence of a hash when the document is ready. But that looked wrong.
Is there a way to make it work in both situations?