我有一个现有的asp.net网络应用程序,使用Facebook来验证用户。我用这Facebook的工具包http://facebooktoolkit.codeplex.com/FB.Init与Facebook开发工具包异步
我的页面有以下代码:
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"
type="text/javascript"></script>
<script type="text/javascript">
//Login and redirect
function onLogin() {
window.location.href = "facebookusermapping.aspx";
}
</script>
<div class="FBLogin"><fb:login-button onlogin="onLogin()"></fb:login-button></div>
<script type="text/javascript">FB.init("<%=ConfigurationManager.AppSettings["ApiKey"]%>","xd_receiver.htm");</script>
我的页面需要花费一些时间,因为它似乎在等待Facebook的登录按钮和东西加载加载,所以有人建议我做异步使用此代码:
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR APP ID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
但这其中使用的工具包,我认为是使用旧的API新的API?
当我使用我现有的代码来检查用户是否通过身份验证时,它总是返回为false。
不需要重新编写太多任何人都知道一种方式,我可以阻止我的页面等待Facebook的东西加载?
谢谢...不幸的是我认为会是这样!我没有意识到,旧的API将在几个月内停止工作!我已经重写了它! – Bex 2010-11-15 11:04:13
我除了新的Facebook C#SDK一直都很开心外,没有什么可以添加的。在那里的其他图书馆有很大的改进。 – mfanto 2011-01-30 22:53:47