Php 如何在facebook上获得swf?
我创建了一个facebook应用程序并加载了登录,但一旦加载,我就会看到一个空白屏幕。看起来我的swf根本没有加载。这是我的index.php文件:Php 如何在facebook上获得swf?,php,facebook,Php,Facebook,我创建了一个facebook应用程序并加载了登录,但一旦加载,我就会看到一个空白屏幕。看起来我的swf根本没有加载。这是我的index.php文件: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <!-- Include support librarys first --> <script
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<!-- Include support librarys first -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
var APP_ID = "my_id";
var REDIRECT_URI = "my_url";
var PERMS = "publish_stream, user_photos"; //comma separated list of extended permissions
function init()
{
FB.init({appId:APP_ID, status: true, cookie: true});
FB.getLoginStatus(handleLoginStatus);
}
function handleLoginStatus(response)
{
if (response.session) { //Show the SWF
swfobject.embedSWF("main.swf", "flashContent", "640", "480", "9.0", null, null, null, {name:"flashContent"});
} else { //ask the user to login
var params = window.location.toString().slice(window.location.toString().indexOf('?'));
top.location = 'https://graph.facebook.com/oauth/authorize?client_id='+APP_ID+'&scope='+PERMS+'&redirect_uri=' + REDIRECT_URI + params;
}
}
$(init);
</script>
</head>
<body>
<div id="fb-root"></div>
<div id="ConnectDemo"></div>
</body>
</html>
var APP_ID=“我的_ID”;
var REDIRECT_URI=“my_url”;
var PERMS=“发布\u流,用户\u照片”//扩展权限的逗号分隔列表
函数init()
{
init({appId:APP_ID,状态:true,cookie:true});
FB.getLoginStatus(handleLoginStatus);
}
函数handleLoginStatus(响应)
{
if(response.session){//显示SWF
embedSWF(“main.swf”、“flashContent”、“640”、“480”、“9.0”、null、null、null、{name:“flashContent”});
}否则{//请用户登录
var params=window.location.toString().slice(window.location.toString().indexOf('?');
顶部位置:https://graph.facebook.com/oauth/authorize?client_id=“+APP_ID+”&scope='+PERMS+”&redirect_uri='+redirect_uri+params;
}
}
美元(初始);
是否有任何原因导致此操作不起作用?swfobject.embeddeswf的第二个参数需要是要向其注入SWF的元素的
id
。您使用的是您的DOM中不存在的flashContent
,和您的应用程序链接?(以便我们可以通过firebug进行检查)如果这确实是答案,那么这个调试步骤应该在发布到StackOverflow之前完成。因此,在你用尽其他选择后,应该将其作为最后手段。