title: FB.login issue, need to show lightbox instead of pop-up, Javascript SDK, iFrame Application
body: <p>I am developing a facebook iFrame application which would be embedded inside a facebook page. I have chosen iFrame as FBML is deprecated by facebook.</p>
  
  <p>My application is ready but I am facing a small problem</p>
  
  <p>when FB.login is called, a popup window appears. My application requirement is that whenever its loaded, it should check whether user is authorized or not, if not then show a Dialog asking for extended permission/login</p>
  
  <p><strong>Problem:</strong>
  The Pop-up is in form of a new window which Safari blocks by default because window is open through javascript and not via click, <strong>I want it to appear as a lightbox/shadow which facebook typically shows for fbml applications</strong></p>
  
  <p>I read at <a href="http://developers.facebook.com/blog/post/312" rel="nofollow">http://developers.facebook.com/blog/post/312</a> that </p>
  
  <blockquote>
    <p>Blockquote
    In order to make a more consistent and secure user experience when connecting accounts, we're changing the behavior of the dialog when a user connects accounts between your site and Facebook when the user is already logged in to Facebook. Previously, the Connect with Facebook dialog appeared in an IFrame "lightbox" within the browser window. After tomorrow's weekly code push, the dialog will pop up in a separate browser window, with an address bar, which matches the user login flow when the user is not logged in to Facebook and tries to connect accounts with your site. This will also make it easier for users to identify that the URL is trustworthy and coming from Facebook. 
    Blockquote</p>
  </blockquote>
  
  <p>But this new feature is clearly not helping me out.</p>
  
  <p>Any workaround for this?</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code> &lt;script src="http://connect.facebook.net/en_US/all.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          FB.init({ appId : '161077430577043', status : true, cookie : true, xfbml  : true });
          FB.getLoginStatus(function(response) {
              // alert("response: " + response.session);
              if (response.session) {
                  // alert("response of getlogin status, permissions:  " + response.perms);
                  login();
              }
              else{
                  document.getElementById('loginStatus').innerHTML = "Login and Grant Permission";
                  logMeIn();
              }
          });
  
          function logMeIn(){
              FB.login(function(response) {
                  // alert("login!");
                if (response.session) {
                      // alert("Granted permissions: " + response.perms);
                      login();
                  } else {
                      // alert("not logged in");
                }
              }, {perms:'read_stream,publish_stream,offline_access,friends_birthday,email'});
          }
          function login(){    
              FB.api('/me', function(response) {
                  document.getElementById('login').innerHTML="Welcome " + response.name;
              });
              getFriendsData();
          }
  
          function getFriendsData(){
              //  fetches data from Graph API
          }
  
      &lt;/script&gt;
  </code></pre>