title: Changing window.location.href in Firefox in response to an onunload event
body: <p>I have a strange JavaScript problem using <code>window.location.href</code>, which apparently only affects Firefox (I'm using 3.6).</p>
  <p>Normally <code>window.location.href</code> would not be read-only, and this works perfectly in Firefox:</p>
  <pre><code>window.location.href = &quot;http://google.com/&quot;;
  </code></pre>
  <p>However, when I call a function in response to an <code>onunload </code>event (<code>&lt;body onunload=&quot;testThis();&quot;&gt;</code>), this doesn't work as expected:</p>
  <pre><code>function testThis() {
      alert (&quot;1: &quot; + window.location.href);
      window.location.href = &quot;http://google.com/&quot;;
      alert (&quot;2: &quot; + window.location.href);
      return false;
  }
  </code></pre>
  <p>In both cases, the alert displays the current location of the page in Firefox, without making the change. There are no JavaScript errors, and the <code>onunload </code>event successfully calls the function, so the problem appears to be editing or replacing the value of <code>window.location.href</code>.</p>
  <p>I've tried using <code>window.location</code>, <code>document.location.href</code>, even tried changing <code>window.location.search</code>. Is it possible that an event, specifically an <code>onunload</code> event, causes <code>window.location.href</code> to become read-only?</p>