title: How to add target="_blank" to JavaScript window.location?
body: <p>The following sets the target to <code>_blank</code>:</p>
  
  <pre><code>if (key == "smk") {
      window.location = "http://www.smkproduction.eu5.org";
      target = "_blank";
      done = 1;
  }
  </code></pre>
  
  <p>But this doesn't seem to work. How do I launch the link in a new tab?</p>
  
  <p>Here is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function ToKey() {
    var done = 0;
    var key = document.tokey.key.value;
    key = key.toLowerCase();
    if (key == "smk") {
      window.location = "http://www.smkproduction.eu5.org";
      target = "_blank"
      done = 1;
    }
    if (done == 0) {
      alert("Kodi nuk është valid!");
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form name="tokey"&gt;
    &lt;table&gt;
      &lt;tr&gt;
        &lt;td&gt;Type the key&lt;/td&gt;
        &lt;td&gt;
          &lt;input type="text" name="key"&gt;
        &lt;/td&gt;
        &lt;td&gt;
        &lt;/td&gt;
        &lt;td&gt;
          &lt;input type="button" value="Go" onClick="ToKey()"&gt;
        &lt;/td&gt;
    &lt;/table&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>