title: This code doesn't work in IE
body: <p>Hi so I have this jQuery/JS script. That basically takes an encoded URL string and parses it and saves variable values into variables. </p>
  
  <p>Basically what PHP's $_GET does. </p>
  
  <pre><code>function getUrlVars() 
  {
   var map = {}; 
   var parts = window.location.search.replace(/[?&amp;]+([^=&amp;]+)(=[^&amp;]*)?/gi, 
  
     function(m,key,value) 
       { map[key] = (value === undefined) ? true : value.substring(1); }); 
  
   return map; 
  }
  </code></pre>
  
  <p>Basically this script does what I want. From this URL string:</p>
  
  <pre><code>/autopop.html?Email=test%40test.com&amp;LastName=Test+last&amp;&amp;FirstName=+Test+First
  </code></pre>
  
  <p>I get the values:</p>
  
  <pre><code>Email = test%40test.com
  
  LastName = Test+last
  
  FirstName = +Test+First
  </code></pre>
  
  <p>What I want to do is Auto-populate a form on this same page with this information.
  (I know what you're thinking a server-side script would be a better solution but the boss says we don't have access to that, trust me, I've tried)</p>
  
  <p>Long story short, here's the rest of my code:</p>
  
  <pre><code>var keys = getUrlVars();
  
  $(document).ready(function(){
      var fname = keys['FirstName'].replace(/\+/g , " ").trim();
      var lname = keys['LastName'].replace(/\+/g , " ").trim();
      var email = decodeURIComponent(keys['Contact0Email'].replace(/\+/g , " ")).trim();
      $("#Email").val(email);
      $("#FirstName").val(fname);
      $("#LastName").val(lname);
  });
  </code></pre>
  
  <p>This code gets the job done. All except for one browser. IE. </p>
  
  <p>IE doesn't support <code>decodeURIComponent</code> or so I've read. In any case, I tried using other functions like <code>decodeURI</code> and <code>escape</code> all producing unwanted results. </p>
  
  <p>My google searches have yielded nothing but, semi-interesting <a href="http://xkr.us/articles/javascript/encode-compare/" rel="nofollow">articles</a> (totally off-topic but thought I'd just share that).</p>
  
  <p>No solutions. Can anyone shed some light? How do I make this work on IE?</p>