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.
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/');
}
}
);
}
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'