• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 389
  • Last Modified:

need to open the Facebook log in page in the parent window itself

Hi,

I need to open the Facebook log in page in the parent window itself instead of pop up window,i have provided the Facebook url in case if not authorize/not logged in but the code is not working?


<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<html>
<head></head>
<body>
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
  FB.init({
    appId      : '379834305480185', // App ID
    channelUrl : 'http://localhost:8080/testfb', // Channel File
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    xfbml      : true  // parse XFBML
  });
  
  FB.Event.subscribe('auth.authResponseChange', function(response) { 
    if (response.status === 'connected') {
      testAPI();
    } else if (response.status === 'not_authorized') {
     [u][b] location.href="www.facebook.com"[/b][/u]
    } else {
    	[u][b]location.href="www.facebook.com"[/b][/u]
    }
  });
  };

  // Load the SDK asynchronously
  (function(d){
   var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
   if (d.getElementById(id)) {return;}
   js = d.createElement('script'); js.id = id; js.async = true;
   js.src = "//connect.facebook.net/en_US/all.js";
   ref.parentNode.insertBefore(js, ref);
  }(document));

  function testAPI() {      
    console.log('Welcome!  Fetching your information.... ');
    FB.api('/me?name,birthday,location', function(response) {
      console.log('Good to see you, ' + response.name + '.' + '.'+ response.birthday);
    });
  }
  
</script>
</body>
</html>

Open in new window

0
Rocking
Asked:
Rocking
1 Solution
 
COBOLdinosaurCommented:
I very much doubt you are going to make that happen unless you have some kind of partnership with Facebook so they will share cookie access.  when you try to run from your parent page the Facebook cookies cannot be accessed because it would be a cross-domain security violation.

No cookies means no logon.

I suggest you contact Facebook and see if they are willing to give you what you need.

Cd&
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now