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