title: Set document title via bookmarklet, how to?
body: <p>I have a bookmarklet that sets up a query string for our in-house bug-tracking system.  It looks for any text that is selected, if so it sanitizes it and sets it up as a query parameter.  Otherwise, it simply navigates to the top-level domain of the intranet site.</p>
  <pre><code>javascript:
  q = document.getSelection();
  u = 'http://my.top.level.domain';
  if ( q == '' )
  {
      q = prompt('Some profoundly insightful text','');
  }
  if ( q != '' )
  {
      t = q.toString().replace(/wicked search text/,'sanitized replacement');
      q = u + '/results.asp?QueryParam1=qp1&amp;QueryParam2=qp2&amp;QueryParam3=' + escape(t);
  }
  else
  {
      q = u;
  }
  window.location = q;
  
  /* WHAT DO I PUT IN HERE? */;
  
  undefined
  </code></pre>
  <p>What I am trying to do now, is to set the page title to the &quot;sanitized&quot; text.  For this, I have tried various permutations of the following:</p>
  <pre><code>window.document.title=t;
  document.onload=function()
  {
      document.title=t;
  };
  </code></pre>
  <p>I have swapped the order, put one before/after the other and so on.  At times, I see the title briefly set to the sanitized replacement text, soon to be replaced by whatever is fetched from our intranet site.  At other times, it has no effect whatsoever.</p>
  <p>Would appreciate if anyone could help with &quot;<em>WHAT DO I PUT IN HERE?</em>&quot; portion of the bookmarklet so that the title of the 'query result' page would be set based on the 'sanitized replacement text'.</p>
  <p>Thank you.</p>