Canvas Web 应用程序提要对话框
我目前正在开发一个画布应用程序,该应用程序将利用 Facebook 提供的社交插件。
该应用程序本身允许用户从表单创建文本文件,如果愿意的话可以下载它,还可以使用“源对话框”将文件发布到他们的源中。
我已经实现了“提要对话框”并且工作正常,但我遇到的问题是,如果用户在提示他们共享文件或取消的对话框中单击“取消”按钮,我的页面上会显示一条消息,说明该帖子已发布当它没有发布到 Facebook 时成功。
我如何更改此设置以显示一条消息,说明该文件未发布到他们的提要中?
这是js代码。
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'http://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
picture: 'http://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
name: 'Game Configuration File Creator',
caption: 'Call of Duty 4: Modern Warfare',
description: 'config_mp.cfg',
redirect_uri: 'https://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
};
function callback(response) {
document.getElementById('msg').innerHTML = 'Post was successful.';
}
FB.ui(obj, callback);
}
I am currently in the process of developing a canvas application that will make use of the social plugins provided by Facebook.
The application itself allows a user to create a text file from a form, download it if they wish and also post the file to their feed using the Feed Dialog.
I have implemented the Feed Dialog and it works fine, but the problem I am getting is that if the user clicks the cancel button from the dialog that prompts them to share the file or cancel, a message is displayed on my page stating that post was successful when it did NOT post to facebook.
How can I alter this to display a message stating that the file was not posted to their feed?
Here is the js code.
function postToFeed() {
// calling the API ...
var obj = {
method: 'feed',
link: 'http://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
picture: 'http://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
name: 'Game Configuration File Creator',
caption: 'Call of Duty 4: Modern Warfare',
description: 'config_mp.cfg',
redirect_uri: 'https://XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
};
function callback(response) {
document.getElementById('msg').innerHTML = 'Post was successful.';
}
FB.ui(obj, callback);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须在回调中检查响应是否有效。
You have to check wether the response was valid or not in your callback.