title: Encoding the entire location.href string
body: <p>I am redirecting the user using <code>window.location.href</code>. </p>
  
  <p>If I do not switch the <code>&amp;</code> to <code>&amp;amp;</code> joining the URL parameters in the string, IE7 and IE8 complain (for example, the <code>&amp;reg</code> is turned into a registered trademark symbol). </p>
  
  <p>If I just write the <code>&amp;</code> as <code>&amp;amp;</code>, my modern Firefox 24.0 doesn't process the parameters because it just reads them as straight <code>&amp;amp;</code>.</p>
  
  <p>How can I encode the URL in such a way that makes both browsers happy? <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent" rel="nofollow"><code>encodeURIComponent()</code></a> just breaks the whole thing for everyone.</p>
  
  <pre><code>window.location.href = '/ex/mypage.php?MemberID=' + memberID + '&amp;reg=reg&amp;rid=' + return_data + '&amp;YearRegisteringFor=' + regYear;
  </code></pre>