title: Can I change the text in the address bar without navigating away?
body: <p>I've made a search page for a client, but in this case the actual search page is in an <code>iframe</code> and the user is presented with a decorative shell surrounding said <code>iframe</code>, which passes its URL parameters to the <code>iframe</code>, which then interprets them and performs a search. This is something I cannot change. It also presents me with the unique problem that if the user types into the search page's search bar to perform another search, the iframe refreshes but the shell page does not. This means the URL is now no longer relevant to the current search. <strong>How can I change the URL in the address bar without navigating away from this shell page?</strong> The whole point of this system is that there is less wait for the <code>iframe</code> to refresh than the whole page, so refreshing the whole page would be counter-productive.</p>
  
  <h2>Full Solution</h2>
  
  <hr>
  
  <p>For anyone wanting just a code snippet, here's my final implementation of Ian's solution:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?PHP
  // ...
  function buildTitleChanger($search) {
      ?&gt;
  
      window.top.history.pushState({search : "&lt;?PHP echo str_replace("\"", "\\\"", $search); ?&gt;"}, document.title, window.location.search);
      window.top.document.title = document.title;&lt;?PHP
  }
  // ...
  ?&gt;
  </code></pre>
  
  <p>it's a little dirty with that inline PHP, but it works 100% of the time :3</p>