简体   繁体   English

共享对话框打开然后关闭

[英]Share dialog opens then closes

My app opens a share dialog when the user submits a form. 用户提交表单时,我的应用程序将打开一个共享对话框。 The dialog is called on document ready (jQuery) when the page refreshes after the submit. 提交后页面刷新时,将在文档就绪(jQuery)上调用该对话框。

The dialog box does open, but then closes a couple of second later. 对话框确实打开,但随后关闭了几秒钟。 This pretty much renders the dialog useless. 这几乎使对话框无用。 If you try and hit 'share' before it closes then it does work, but obviously most users aren't going to try and race it. 如果您尝试在关闭之前点击“共享”,那么它确实可以工作,但是显然,大多数用户不会尝试使用它。

The app can be found here: https://apps.facebook.com/topmoviesseen/ 该应用程序可以在这里找到: https : //apps.facebook.com/topmoviesseen/

I have noticed that it can be tempremental, with the odd time seeing it work perfectly. 我注意到它可能是临时性的,奇怪的是看到它完美运行。 Other times the dialog disappears only to reappear 4 or 5 seconds later. 其他时间,对话框消失仅在4或5秒后重新出现。 I would hazard a guess that there is some sort of JS affecting either the z-index or visibility of the box, but I cannot find anything. 我可能会猜测有某种JS​​会影响框的z-index或可见性,但我找不到任何东西。

Any help is hugely appreciated. 任何帮助深表感谢。

Code used to call dialog: 用于调用对话框的代码:

     $(document).ready(function(){
        // calling the API ...
        var obj = {
          method: 'feed',
          display: 'iframe',
          access_token: 'example',
          name: 'Top 100 Movies Seen',
          link: 'https://apps.facebook.com/topmoviesseen/',
          picture: 'https://mgnewmedia.com/topmovies/assets/images/for_stream.png',
          description: 'I have seen 62 of the top 100 movies of all time.  How many have you seen?',
          caption: 'Done any better?',
          message: '62 out of 100 isn\'t bad.'
        };

        FB.ui(obj, callback);
    });

you have to make sure your FB.ui is called after your FB.init is complete, so setting it in the window.fbAsycncInit listener will help: 您必须确保在FB.init完成后调用FB.ui,因此在window.fbAsycncInit侦听器中进行设置将有助于:

window.fbAsyncInit = function() { 
    FB.ui(...) 
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM