Facebookのカスタムアクション投稿で[オブジェクト](下の赤でマーク)にカスタムリンクを追加しようとしています。
これは私のコードです:
FB.api('/me/testapponens:cook', 'post',
{ recipe: 'http://foobar.com/page1.html' },
function(response) {
if (!response || response.error) {
alert('Error occured');
} else {
alert('Cook was successful! Action ID: ' + response.id);
}
});
さて、http://foobar.com/page1.html
私の「レシピ」に「 」を記載したので、これが投稿されると、このページからオープングラフのプロパティが選択されます。
問題: リンクをサードパーティ リンク www.thirdparty.com/page1.html として表示する必要がありますが、開いているグラフのメタ プロパティを thirdparty.com/page1.html に書き込むことはできません (そのページを制御できないため) )。
だから、私はこれを行うことにしました:
i) Create a dummy page : www.foobar.com/page1.html.
ii) Add all the og meta to it.
iii) Add a redirect (javascript) code to the dummy page so that it goes to the third party page.
www.foobar.com/page1.html
次のようになります。
<html ...>
<title> Page 1 </title>
<meta property="fb:app_id" content="..." />
...
<script type="text/javascript">
function redirect1()
{
window.location = "http://thirdparty.com/page1.html"
}
</script>
</head>
<body onLoad="redirect1()"></body>
</html>
質問: これはハッキーなアプローチであり、ユーザーには受け入れられない可能性があると思います。これを行うより良い方法はありますか?私が何をしようとしているのか説明できなかった場合はお知らせください。
PS : 私はスパマーではありません。第三者のページはクライアントからのものであり、ユーザーを誤解させようとしているわけではありません。