Canvas Web 应用程序提要对话框

发布于 2025-01-02 22:41:58 字数 1244 浏览 0 评论 0原文

我目前正在开发一个画布应用程序,该应用程序将利用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

荆棘i 2025-01-09 22:41:58

您必须在回调中检查响应是否有效。

function callback(response) {
    if (response && response.post_id) {
      alert('Post was published.');
    } else {
      alert('Post was not published.');
    }
  }

You have to check wether the response was valid or not in your callback.

function callback(response) {
    if (response && response.post_id) {
      alert('Post was published.');
    } else {
      alert('Post was not published.');
    }
  }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文