Learning Facebook connect

Source: Internet
Author: User

Http://wiki.developers.facebook.com/index.php/Trying_Out_Facebook_Connect
Facebook
Connect is used to quickly integrate your site with Facebook account.

I look into http://www.somethingtoputhere.com/therunaround/index.php
Demo site using fackbook connect, and come to some results:

1. Click "Connect with Facebook" button, a popup window appears.
It's
Page of Facebook: http://www.connect.facebook.com/login.php

2. login to Facebook use your account, the result is:

<HTML> HTTP-equiv = "refresh"
Content = "0; url = http://www.somethingtoputhere.com/therunaround/xd_receiver.php? Fb_login & fname = _ opener & session = % 7b % 22session_key % 22% 3A % 223. tatfpjet3u ......"
/> </Head> <body>

3. The page is redirect
Http://www.somethingtoputhere.com/therunaround/xd_receiver.php,
The user session is passed in.

Let's look at the Javascript file contains in the xd_receiver.php.
I
Have modify the JS file to show the main logic:

VaR pathname = Document. url;

Hashindex = pathname. indexof ('fb _ login &');

Hash = pathname. substring (hashindex + 9 );

VaR packetstart = hash. indexof ('&');

// "_ Opener"

VaR frame_name = hash. substr (6, packetStart-6 );

If (frame_name = "_ opener "){

Hostwindow = hostwindow. opener;

}

// "% 7b % 22session_key % 22% 3A % 223. tatfpjet3u ......"

Packet_string = hash. substr (packetstart + 1 );

// Invoke parent window's function, and pass in the Session Identification

Hostwindow. FB. xdcomm. server. Singleton. onreceiverloaded (packet_string );

4. Now your site receive the Facebook account identification.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.