title: GET Variable + Javascript No Trim IE
body: <p>I used the below code to pull a get variable from URL. It works in Chrome and FF but not in IE.  </p>
  
  <pre><code>www.example.com/index.php?link=123
  </code></pre>
  
  <p>In Chrome/FF, the variable <code>first</code> returns <code>"123"</code> but in IE the variable <code>first</code> returns <code>"www.example.com/123"</code></p>
  
  <p>Any ideas on how to fix the code so that in IE it returns <code>"123"</code>?</p>
  
  <pre><code>function getUrlVars() {
    var map = {};
    var parts = window.location.href.replace(/[?&amp;]+([^=&amp;]+)=([^&amp;]*)/gi, function(m,key,value {
      map[key] = value;
    });
    return map;
  }
  
  var first = getUrlVars()["link"];
  </code></pre>