Using FB.ui for "apprequest" and "feed" - JS error - c is not defined
I have developed two applications with FB.ui()
calls to send app requests and ask to post status update with the "feed" parameters. It worked fine for several months, but for the past week I have been encountering error :
c is undefined line 18 : FB.provide('Dom',{containsCss:function...(oldonload);}else oldonload();};})(); File : all.js
It's from the file all.js I import to use FB object from the url : http://connect.facebook.net/fr_FR/all.js (i also tried http://connect.facebook.net/en_US/all.js)
This is the part of the code which causes the error :
window.addEvent('domready', function() {
if(jsonRedirection.redirect == false) {
FB.init({
appId : FBappId,
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
}
});
function addFriends()
{
FB.ui({
met开发者_StackOverflow中文版hod: 'apprequests',
message: 'Test'
},
function(response) {
if(response != null) {
alert('ok');
}
}
);
}
I check my appId and I have the "fb-root" div before I call my addFriends function ...
"c is undefined" - This occurs due to mootools conflict. In uncompressed mootools file, there is a function " Function.implement({ ". You can solve the issue by hiding this.
Let me know, If you get this work.
To be exact. With In, Function.implement({ there will be a "create: function(options){" . Just rename 'create' by 'Create'. ie., Make C - capital letter. I Hope, this will solve the issue.
Problem is in the Function prototype..
Function.implement({
extend: function(properties){
for (var property in properties) this[property] = properties[property];
return this;
},
create: function(options){
And FB SDK function:
create:function(c,h){var e=window.FB,d=c?c.split('.'):[],a=d.length;for(var b=0;b<a;b++){var g=d[b];var f=e[g];if(!f){f=(h&&b+1==a)?h:{};e[g]=f;}e=f;}return e;}
Solution: In mootools, Rename "create" to "create2" then, replace all "create(" by "create2("
Its horrible.. but, works..
MooTools version 1.4.3 solves this issue - you may download it from Download MooTools 1.4.3
精彩评论