Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-10-31
1
Medium Priority
?
380 Views
Last Modified: 2013-11-20
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
Comment
Question by:Rocking
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 1000 total points
ID: 39616856
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
There are countless ways to use social media and often times businesses are not using it properly. Is your business making any social media mistakes? Here are some tips to get your foot in the door with social media and make the most of it for your …
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question