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
Solved

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

Posted on 2013-10-31
1
348 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
1 Comment
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

856 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