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.