facebook登录后页面不会重新加载ie ie
问题描述:
在我的aspx页面中,我有一个模式弹出框中的Facebook登录按钮。当用户点击并登录时,我使用Facebook C#sdk捕获登录细节。在登录之前,我显示登录div和登录后showine用户div。facebook登录后页面不会重新加载ie ie
它适用于除IE以外的所有浏览器。登录模式弹出窗口后关闭但页面不重新加载。本地它甚至在IE中也能正常工作。但在facebook应用登录后,用户div不显示。请帮忙。
aspx code below
<div class="fb-login-button" onlogin="javascript:Reload();" scope="email,publish_stream,manage_pages,offline_access" onclick="document.getElementById('divWait').style.display = 'block';" >Login with Facebook</div>
我的javascript代码如下。
<script > (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=221678077921242";
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));</script>
<script>
window.fbAsyncInit = function() {
FB.init({
appId: '311257055585019',
channelUrl: '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true, // parse XFBML
oauth: true
});
};
(function(d) {
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) { return; }
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
} (document));
</script>
<script type="text/javascript">
function Reload() {
window.location.href = "urlred.aspx?page=delmode.aspx&fb=1";
}
</script>
我的asp.net代码如下
FacebookWebContext wc = new FacebookWebContext(new FBSettings() { AppId = ConfigurationSettings.AppSettings["LogApi"].ToString(), AppSecret = ConfigurationSettings.AppSettings["LogSecret"].ToString() });
Facebook.Web.FacebookWebClient cl = new Facebook.Web.FacebookWebClient(wc);
if ((wc.Session != null && wc.Session.AccessToken != null && iLogin == 1))
{Facebook.JsonObject fbUser = (Facebook.JsonObject)cl.Get("/me");
if (fbUser.Count > 0)
{
//do other work
}
}
答
你必须频道网址设置为实际值。您不能使用默认值:
channelUrl: '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
将channel.html文件添加到您的站点并适当地设置值。您可以在Facebook的开发人员文档中找到有关频道文件的更多信息。