title: JavaScript - splitting window.location.href returns undefined
body: <p>I have the following code JavaScript:</p>
  
  <pre><code>var url = window.location.href;
  
  var link = url.split('?link=');
  
  link[1] = "http://goo.gl/" + link[1];
  link[2] = "http://goo.gl/" + link[2];
  
  function ad(){
    window.location.href = link[1];
  }
  
  function ac(){
    window.open(link[2], '_blank');
  }
  </code></pre>
  
  <p>And there is a link:</p>
  
  <pre><code>&lt;a href="javascript:ac();" onclick="ad();"&gt;ACCESS&lt;/a&gt;
  </code></pre>
  
  <p>The problem is that in some computers, the split is not working.</p>
  
  <p>For exemple: If the link is <code>mySite.com/link.html?link=wfijOp?link=atGdj</code>.
  It should give me <code>goo.gl/wfijOp</code> and <code>goo.gl/atGdj</code> instead of <code>goo.gl/undefined</code> and <code>goo.gl/undefined</code>.</p>
  
  <p>What is the problem with those computers?</p>