title: Javascript confirm closes instantly in chrome
body: <p>This code is working correctly in firefox and IE but in chrome the javascript confirm window displays for just a second and instantly closes (and runs the else statement sending someone away from the page)</p>
  
  <p>What is wrong with this code in Chrome?</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>var alerted = '';
  
  if (alerted != 'yes') {
    if (confirm("Accept?")) {
      localStorage.setItem('alerted', 'yes');
      //box.checked = true;
    }
    else {
      window.location.assign('https://www.example.com/previous-page/');
    }
  }</code></pre>
  </div>
  </div>
  </p>