FBJS AJAX.post 在权限对话框后不起作用
我在使用基于 flash 的 facebook 应用程序时遇到问题,该应用程序使用 FBJS-bridge 与 PHP 进行通信。当某人第一次使用该应用程序时,他/她会被要求提供各种权限。之后,Flash 使用 ajax 联系 PHP,但请求从未发送。当您刷新页面时,一切正常,没有任何问题。 如果您在隐私设置中删除该应用程序,请刷新页面并重试 - 会发生相同的错误。如果您允许应用程序,请刷新页面,在其他选项卡中删除应用程序并在上一个选项卡中启动应用程序 - 系统会要求用户提供权限,但在允许应用程序后一切正常。
这是 FBJS 代码
function openPermissions(){
Facebook.showPermissionDialog(/*permissions string*/, permissionOnDone);
}
function permissionOnDone(perms){
if (!perms) {
document.getElementById("indexswf").callSWF('noallow');
} else {
document.getElementById("indexswf").callSWF('allow');
}
}
function ajaxCall(url,parameters){
var params = {};
for(var i=0;i<parameters.length;i+=2){
params[parameters[i]]=parameters[i+1];
}
ajax = new Ajax();
ajax.requireLogin = true;
ajax.responseType = Ajax.RAW;
ajax.ondone = function(data){
document.getElementById("indexswf").callSWF('parseAjax', data);
}
ajax.post('http://the.url.to/the_real_server/not_to_the_fb_url/'+url,params);
}
openPermissions 被调用来显示权限对话框,并在允许 flash 时调用函数allow()。在Flash中,allow()调用JS函数ajaxCall(),该函数应该发出ajax请求。但是,ajax.post 从不发送请求。我肯定知道这一点,因为 flash 函数 parseAjax 从未被调用,而且浏览器中的调试工具也没有显示任何 ajax 请求。 URL和参数与运行时相同。未检测到 Flash 或 JS 错误... 有人知道这里出了什么问题吗?也许 Facebook 又出问题了,因为几天前这一切都在工作......
I have problems with facebook application based on flash which communicate with PHP using FBJS-bridge. When someone use the application for the first time, he/she is asked for various permissions. After that, flash contact PHP with ajax but request is never sent. When you refresh page, everything is working without any problems.
If you remove the application on privacy settings, refresh the page and try again - same bug happens. If you allow application, refresh page, in other tab remove application and start application in previous tab - user is asked for permissions but everything is working after allowing application.
This is FBJS code
function openPermissions(){
Facebook.showPermissionDialog(/*permissions string*/, permissionOnDone);
}
function permissionOnDone(perms){
if (!perms) {
document.getElementById("indexswf").callSWF('noallow');
} else {
document.getElementById("indexswf").callSWF('allow');
}
}
function ajaxCall(url,parameters){
var params = {};
for(var i=0;i<parameters.length;i+=2){
params[parameters[i]]=parameters[i+1];
}
ajax = new Ajax();
ajax.requireLogin = true;
ajax.responseType = Ajax.RAW;
ajax.ondone = function(data){
document.getElementById("indexswf").callSWF('parseAjax', data);
}
ajax.post('http://the.url.to/the_real_server/not_to_the_fb_url/'+url,params);
}
openPermissions is called to display permission dialog, and on allow flash function allow() is called. In flash, allow() calls JS function ajaxCall(), which should make ajax request. But, ajax.post never sends request. I know that for sure, because flash function parseAjax was never called and also debugging tools in browsers are not showing any ajax requests. URL and parameters are same as when it is working. No flash or JS errors are detected...
Anyone have idea what is wrong here? Maybe facebook bug again since this was all working few days ago...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于某种原因 ajax.requireLogin = true 应设置为 false
ajax.requireLogin = true should be set to false for some reason