Problem with FB.ui apprequest dialog

只谈情不闲聊 提交于 2019-12-12 03:01:38

问题


I am trying to send application invites from an Iframe application. I open the dialog like this.

function sendRequestToOneRecipient(user_id) {
        FB.ui({method: 'apprequests',
          message: 'message',
          to: user_id,
          display: 'popup'
        }, requestCallback(user_id));
      }

When the dialog opens I get a ton of "Unsafe JavaScript attempt to access frame with URL from frame with URL" error messages. The send and cancel buttons just make the dialog go blank, but not close and it doesn't work.

I don't know if it's related or not, but when loading the JS SDK in Chrome I get "Cannot read property 'cb' of undefined" and Firefox says "b is undefined". I do not have any references to the old FeatureLoader.js anymore.


回答1:


Thats the code I use to send apprequest, and never had problem either with Chrome or Firefox ... :s

They post recently more examples recently here : http://developers.facebook.com/docs/reference/dialogs/requests/

Hope that helps

function send_apprequest(){
var post_options = {
    method: 'apprequests',
    display: 'iframe', 
    message: "My  message",
    data: "Any data your want to pass",
    title: "My Title",
    ref: "Not required but useful for Insights"
};

FB.ui(post_options,function(response) {
                if (response && response.request_ids) {
                        alert('\o/');

                       }
                }            
         ); 
}



回答2:


I found the problem. There was an included Javascript file that was conflicting with Facebook's Javascript. I'm not really sure exactly what was conflicting, but it was a JSON library from 2005. Thankfully, it's not being used so I just removed it. This is the copyright information on the file.

// VC-JSON
/*

PROJECT:    JDM (Java Dynamic Machine)
PROGRAMMER: PRIVATE LICENSE
FILE:       vc-json/vc-json.js
PURPOSE:    GO! SERIALIZER & DE-SERIALIZER...

Includes functions for:

-- JSON/GO! Serialization
-- JSON/GO! DE-Serialization
-- JSON/GO! Parsing

*/

var JSON = {


version : "0.000a",
org: 'http://www.JSON.org',
copyright: '(c)2005 JSON.org',
license: 'http://www.crockford.com/JSON/license.html'


来源:https://stackoverflow.com/questions/7562360/problem-with-fb-ui-apprequest-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!