title: How to redirect a page to another page when refresh at second attempt
body: <pre><code>&lt;script language="JavaScript"&gt;
    window.onbeforeunload = confirmExit;
    function confirmExit()
    {
     alert("");window.location="index.html";
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>I tried this code, but it is not working.</p>