title: login with facebook popup window does not close and my after-login page opens in the popup window itself
body: <p>When the facebook popup window opens, after entering the email and password; the popup window does not close. The page that is supposed to load after successful login loads in the popup window itself. If i manually close this popup window and refresh the parent page then everything works well. </p>
  
  <p>I have used windows.close and window.opener.location.reload function in javascript but it doesnt seem to work</p>
  
  <p>I'm using codeigniter:</p>
  
  <p>my controller</p>
  
  <pre><code>    &lt;?php
  class Landing extends CI_Controller {
      private $user = null;
      public function __construct()
      {
          parent:: __construct();
          parse_str($_SERVER['QUERY_STRING'], $_REQUEST);     
          //print_r($this-&gt;session-&gt;all_userdata());
          $redirect_url = (isset($_GET['redirect_url'])) ? $_GET['redirect_url'] : '';
          if($this-&gt;session-&gt;userdata('loginStatus')) {
              if($redirect_url &amp;&amp; $redirect_url !=='') {
                  redirect($_GET['redirect_url']);
              } else {
                  redirect('home');
              }
          }
  
  
          $this-&gt;load-&gt;library('fb_api/facebook', array("appId" =&gt; $this-&gt;config-&gt;item('appId') , "secret" =&gt; $this-&gt;config-&gt;item('secret')));
          $this-&gt;user = $this-&gt;facebook-&gt;getUser();
  
      }
  
      public function index(){
          if (isset($_REQUEST['state']) &amp;&amp; isset($_REQUEST['code'])) {
                  echo "&lt;script&gt;window.close();window.opener.location.reload();&lt;/script&gt;";
              } else {
                  // load page
              }
  
          if ($this-&gt;user) {
            try {
  </code></pre>
  
  <p>view:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var baseUrlJs = '&lt;?php echo base_url()?&gt;';
      var sessMemLayer = "&lt;?=$this-&gt;session-&gt;userdata('loginStatus')?&gt;";
      &lt;?php if ($loginFbUrl) { ?&gt;
      var newwindow;
      var intId;
      function loginFB(){
          var  screenX    = typeof window.screenX != 'undefined' ? window.screenX : window.screenLeft,
               screenY    = typeof window.screenY != 'undefined' ? window.screenY : window.screenTop,
               outerWidth = typeof window.outerWidth != 'undefined' ? window.outerWidth : document.body.clientWidth,
               outerHeight = typeof window.outerHeight != 'undefined' ? window.outerHeight : (document.body.clientHeight - 22),
               width    = 500,
               height   = 270,
               left     = parseInt(screenX + ((outerWidth - width) / 2), 10),
               top      = parseInt(screenY + ((outerHeight - height) / 2.5), 10),
               features = (
                  'width=' + width +
                  ',height=' + height +
                  ',left=' + left +
                  ',top=' + top
                );
  
          newwindow=window.open('&lt;?=$loginFbUrl?&gt;','Login_by_facebook',features);
  
         if (window.focus) {newwindow.focus()}
        return false;
  
      }
  
      &lt;?php } ?&gt;
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Please help
  thanks</p>