title: Is this the correct way to redirect?
body: <p>In reponse to <a href="https://stackoverflow.com/questions/6764243/why-wont-window-location-load-a-new-page/6764352#6764352">this question</a> I wrote this function (well, I made it a bit more elaborate then in that answer):</p>
  
  <pre><code>function redirectto(url) {
      window.location.href = url; // first try it the easy way
  
      // we're going to do it the hard way - create a temporary form and submit it
      var tmpform = document.createElement("form");
      tmpform.method = "GET";
  
      // add data, use hidden fields for querystrings
      if (url.indexOf("?") == -1) {
          tmpform.action = url;
      } else {
          var urlparts = url.split("?", 2);
          tmpform.action = urlparts[0];
  
          var queryparts = urlparts[1].replace(/\+/g, " ").split(/[&amp;;]/g);
          for (var i = 0; i &lt; queryparts.length; i++) {
              var pair = queryparts[i].split("=");
              var key = pair[0];
              var value = pair.length &gt; 1 ? pair[1] : "";
  
              var field;
              try { // sigh IE, can't you do ANYTHING right?
                  field = document.createElement("&lt;input type=\"hidden\" name=\"" + key + "\" value=\"" + value + "\"&gt;");
              } catch(err) {
                  field = document.createElement("input");
                  field.type = "hidden";
                  field.name = key;
                  field.value = value;
              }
              tmpform.appendChild(field);
          }
      }
  
      // add to page and submit
      document.body.appendChild(tmpform);
      tmpform.submit();
  }
  </code></pre>
  
  <p>The answer I wrote got 3 downvotes, so my question is: is this the correct way to do this or is simply <code>window.location.href = url</code> enough?</p>