大佬教程收集整理的这篇文章主要介绍了javascript – Facebook登录未在Safari / iPhone中打开,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在创建一个显示Facebook好友的应用程序.首先,用户需要点击登录按钮,然后在填写登录ID和密码后会出现一个简单的弹出屏幕,它会显示好友列表.
一切正常,可在Firefox,Chrome,IE上运行但不会在Safari和iPhone中打开弹出窗口.
有人建议我在channelUrl中添加域名和频道名称.我创建了一个channel.html并添加引用,但它没有帮助我.
我搜索了很多,但没有找到帮助.
这是我的代码.
Custom.js
function getUser()
{
FB.init({
appId : '289403314507596',// App ID
channelUrl : 'http://bc2-236-161.compute-1.amazonaws.com/html/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
});
(function(d){
var js,id = 'facebook-jssdk',ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js,ref);
}(document));
//check current user login status
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
window.location="facebook_friend.html"
loadFriends();
} else {
//user is not connected.
FB.login(function(response) {
if (response.authResponse) {
window.location="facebook_friend.html"
loadFriends();
} else {
alert('User cancelled login or did not fully authorize.');
}
});
}
});
}
//start from here
$(document).ready(function(){
$('.load-button').click(function(){
getUser();
});
});
channel.html
refer_friend.html
我在这个文件中添加了custom.js的引用
最佳答案
好的……浪费了我一整天后我得到了答案.使用Javascript_Facebook Sdk,当您单击Login按钮时,它将打开弹出窗口.在Safari或iPhone(我的)中,我启用了Block-popup选项.
因此我无法看到Facebook登录窗口.你需要允许弹出窗口.
您可以通过单击允许弹出窗口
Safari-disable Block pop-up windows
要么
safari-preference-then disable checkbox of pop-up window's
或者您可以使用键盘快捷键:
shift-[command key]-K.
干杯.
大佬总结
以上是大佬教程为你收集整理的javascript – Facebook登录未在Safari / iPhone中打开全部内容,希望文章能够帮你解决javascript – Facebook登录未在Safari / iPhone中打开所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。