title: Is it safe to use window.history.replaceState() in <head>?
body: <p>I'd like to remove the <code>#_=_</code> artefact that <a href="https://stackoverflow.com/q/7131909/759866">Facebook adds to URLs</a> when a user logs in on my website.</p>
  <p>I'm using this script:</p>
  <pre class="lang-js prettyprint-override"><code>if (window.location.hash === '#_=_') {
      const uri = window.location.toString();
      const withNoHash = uri.substring(0, uri.indexOf('#'));
      window.history.replaceState({}, document.title, withNoHash);
  }
  </code></pre>
  <p>I'd like the script to fire as soon as possible, so I've put it in the <code>&lt;head&gt;</code> and it seems to work fine on Chrome &amp; Firefox.</p>
  <p><strong>Is it standardized that the <code>window.history</code> API is ready when the script executes in <code>&lt;head&gt;</code>?</strong></p>
  <p>(and <code>document.title</code>, by the way).</p>