Facebookによると、すぐにすべてのFBMLアプリが廃止されるため、ここを参照して、この方法でダイアログを作成することをお勧めします。現在使用しているスクリプトを提供できます。ここで、丸で囲んだリンクからアプリのホームページにアクセスできます。注意が必要です-私のアプリは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