按照Facebook是deprecating all FBML apps soon,我勸你look here,並嘗試以這種方式創建一個對話框。我可以給你我正在使用的腳本,你圈出的鏈接指向我的應用的主頁。應該做一個筆記 - 我的應用程序是一個Iframe應用程序。
<script type="text/javascript">
FB.ui(
{
method: 'stream.publish',
attachment: {
name: 'name',
caption: 'caption',
source: 'picture.jpg',
picture: 'picture.jpg',
description: 'description',
href: 'http://apps.facebook.com/appname'
},
action_links: [
{ text: 'name', href: 'http://apps.facebook.com/appname' }
]
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
</script>
不過,若你要保持你的應用在FBML形式,試試這個代碼:
<script type="text/javascript">
FB.ui(
{
method: 'stream.publish',
attachment: {
name: 'name',
caption: 'caption',
source: 'picture.jpg',
picture: 'picture.jpg',
description: 'description',
href: 'http://apps.facebook.com/appname/index.php'
},
action_links: [
{ text: 'name', href: 'http://apps.facebook.com/appname/index.php' }
]
},
function(response) {
if (response && response.post_id) {
alert('Post was published.');
} else {
alert('Post was not published.');
}
}
);
</script>
您需要了解iFrame和FBML應用程序之間的區別:雖然的Iframe應用軟件可以使用戶始終保持在同一頁面中,並且只有Iframe中的內容發生更改,FBML應用程序實際上將用戶從一個頁面移動到另一個頁面。因此,在FBML應用程序中指定鏈接時,使用http://apps.facebook.com/appname/page
鏈接而不是http://www.yoursite.com/page
鏈接很重要。
實例鏈接:
- 在您的網站的鏈接:
http://www.yoursite.com/game1.php
- 看起來像這樣在FBML應用:
http://apps.facebook.com/appname/game1.php
檢查$ canvasURL廣告$ tale_id那什麼是變量在他們的價值。它可能發生,他們指向任何其他應用程序。只是回聲這些變量,並看到他們的價值 – 2011-01-31 12:02:50
這些都很好,但我認爲在某些設置有一些問題,但不明白從哪裏我可以設置此 – Hafiz 2011-01-31 12:13:21