下面是我的項目的Facebook測試頁面的源代碼,其中包含幾個常見Facebook任務的完整實現。編輯的唯一內容是Facebook應用ID。顯然,你沒有我們的庫,但在這種情況下,他們只是驗證會話並繪製標題。
<html>
<head>
<meta charset="UTF-8" />
<title>phyre Lux Client</title>
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../js/jquery-ui-1.8.5.custom.min.js"></script>
<script type="text/javascript" src="../phyrelib-clientside.js"></script>
<link type="text/css" href="../css/custom-theme/jquery-ui-1.8.5.custom.css" rel="stylesheet">
<link type="text/css" href="../css/phyre.css" rel="stylesheet">
<script src="js/typeface.js"></script>
<script src="js/cicle_fina.typeface.js"></script>
</head>
<body onLoad='return 0;' id='luxDocBody' class='phyremodule'>
<div id='fb-root'></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script type='text/javascript'>
FB.init({appId: 'REDACTED', status: true, cookie: true, xfbml: true});
FB.Event.subscribe('auth.sessionChange', function(response) {
if (response.session) {
// A user has logged in, and a new cookie has been saved
alert('yay');
} else {
// The user has logged out, and the cookie has been cleared
alert('nay');
}
});
FB.ui(
{
method: 'stream.publish',
message: 'getting educated about Facebook Connect',
attachment: {
name: 'Connect',
caption: 'The Facebook Connect JavaScript SDK',
description: (
'A small JavaScript library that allows you to harness ' +
'the power of Facebook, bringing the user\'s identity, ' +
'social graph and distribution power to your site.'
),
href: 'http://github.com/facebook/connect-js'
},
action_links: [
{ text: 'Code', href: 'http://github.com/facebook/connect-js' }
],
user_message_prompt: 'Share your thoughts about Connect'
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
FB.getLoginStatus(function(response) {
if (response.session) {
// logged in and connected user, someone you know
alert('yay');
} else {
// no user session available, someone you dont know
alert('nay');
}
});
</script>
<fb:login-button></fb:login-button>
</body>
</html>
我調整它變成一個純HTML文件,現在,我得到錯誤信息e.root未定義 [打破這個錯誤] FB.provide( '內容',{_根:空,_hidd ...它(); a.parentNode.removeChild的(a);}}); all.js(line 6 – 2011-04-01 21:45:44
我省略了luxFooter(); funciton,剛添加它仍然是一樣的錯誤 – 2011-04-01 21:50:15
所有的js代碼都在HEAD標籤裏面並且