Facebook 分享和发布后重定向用户
如果用户发布,如何将用户重定向到特定 URL,如果用户跳过,如何重定向到不同的 URL?
https://www.facebook.com/dialog/feed?
app_id=123050457758183&
link=https://developers.facebook.com/docs/reference/dialogs/&
picture=http://fbrell.com/f8.jpg&
name=Facebook%20Dialogs&
caption=Reference%20Documentation&
description=Using%20Dialogs%20to%20interact%20with%20users.&
message=Facebook%20Dialogs%20are%20so%20easy!&
redirect_uri=http://www.example.com/response
无论用户单击“发布”还是“跳过”,上面的示例都会将用户重定向到相同的 URL。
我尝试了下面给出的示例:
<script>
FB.init({appId: " id", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'link to share',
picture: 'gggg',
name: 'ggg',
caption: 'ggg.',
description: 'ggg.'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post successfully published, Post ID: " + response['post_id'] + " click here";
var str = "Click here to activate your new timeline facebook profile!";
document.write(str.link("redirection url here"));
}
FB.ui(obj, callback);
}
但是上面的示例也无法给出结果。
How can I redirect a user to a specific URL if the user publishes and to a different URL if he skips?
https://www.facebook.com/dialog/feed?
app_id=123050457758183&
link=https://developers.facebook.com/docs/reference/dialogs/&
picture=http://fbrell.com/f8.jpg&
name=Facebook%20Dialogs&
caption=Reference%20Documentation&
description=Using%20Dialogs%20to%20interact%20with%20users.&
message=Facebook%20Dialogs%20are%20so%20easy!&
redirect_uri=http://www.example.com/response
The above example redirects the user to same URL whether he clicks publish or skip.
I tried the example given below:
<script>
FB.init({appId: " id", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'link to share',
picture: 'gggg',
name: 'ggg',
caption: 'ggg.',
description: 'ggg.'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post successfully published, Post ID: " + response['post_id'] + " click here";
var str = "Click here to activate your new timeline facebook profile!";
document.write(str.link("redirection url here"));
}
FB.ui(obj, callback);
}
But the above example also is unable to give results.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
和你的有点不同,但我希望你能明白。我们使用自己的框架,所以我不能保证 FB 初始化是正确的:(
A bit different from yours but I hope you get the idea. We're using our own framework so I can't guarantee the FB initialization is correct :(