title: PHP redirection using header
body: <p>My web structure is</p>
  
  <hr>
  
  <pre><code>         Header-of-page
  </code></pre>
  
  <hr>
  
  <p>Nav Link || iFrame</p>
  
  <hr>
  
  <pre><code>       Footer
  </code></pre>
  
  <hr>
  
  <p>I'm Trying to handle session timeout, when session has timeout I'm trying to redirect page to login page, this works fine(session timeout).</p>
  
  <p><strong>Problem:</strong>
  When I'm redirecting the page,login page is displayed in iFrame, which is not expected.</p>
  
  <p>How can I redirect to login page(whole window),rather than opeing it in iFrame.</p>
  
  <p><strong>I Tried:</strong>
  1. using header
  2. using javascript(Commented)</p>
  
  <pre><code>&lt;?php session_start();
  
  $timeout = 1; // Set timeout minutes
  $timeout = $timeout * 60; // Converts minutes to seconds
  
  if (isset($_SESSION['timeout'])) 
  {
      $session_life = time() - $_SESSION['timeout'];
      if ($session_life &gt; $timeout) 
      {
          session_destroy();
          header("Location: login.php?msg=timeout");
          // echo '&lt;script language="javascript"&gt;'; 
                      // echo 'window.location.replace("login.php");';
                      // echo '&lt;/script&gt;';
      }
  }
  $_SESSION['timeout'] = time();
  
  ?&gt;
  </code></pre>
  
  <p>Please guide me for this issue. Thanks!</p>