0
다음 코드는 Firefox 또는 IE에서는 작동하지 않지만 Chrome에서는 정상적으로 실행됩니다. 나는 누군가가 내가 잘못하고있는 것에 대해 통찰력을 가지기를 바라고있다. Facebook 캔버스에서 단결 게임을 실행하는 데 사용됩니다.Firefox에서 getLoginStatus()가 응답을 얻지 못합니다. 즉,
<script type='text/javascript'>
var appID = 'xxxxxxxxxxxxxxxxxxx';
var connected = false;
var loggedin = false;
var purchaseResult = "Failed";
var inviteResult = "Failed";
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : appID, // App ID from the App Dashboard
status : true, // check the login status upon init?
cookie : true, // set sessions cookies to allow your server to access the session?
oauth : true, // enable OAuth 2.0
frictionlessRequests : true,
xfbml : false // parse XFBML tags on this page?
});
// Additional initialization code such as adding Event Listeners goes here
//Get the current login status.
document.getElementById("text").innerText = "Getting login status";
console.log("Getting login status");
FB.getLoginStatus(function(response) {
console.log("got response");
var user_box = document.getElementById("login");
//document.getElementById("text").innerText = "Got response: " + response.status;
if (response.status === 'connected') {
// the user is logged in and has authenticated your
// app, and response.authResponse supplies
// the user's ID, a valid access token, a signed
// request, and the time the access token
// and signed request each expire
var uid = response.authResponse.userID;
console.log("Getting login status returned user id: " + uid);
var accessToken = response.authResponse.accessToken;
//user_box.style.visibility = 'hidden';
loggedin = true;
//document.write("Connected to facebook");
} else if (response.status === 'not_authorized') {
// the user is logged in to Facebook,
// but has not authenticated your app
user_box.style.display = 'block';
FB.Event.subscribe('auth.login', function(response) {
// Let unity know the user has logged in
GetCurrentUser();
user_box.style.display = 'none';
});
} else {
// the user isn't logged in to Facebook.
FB.Event.subscribe('auth.login', function(response) {
// Let unity know the user has logged in
GetCurrentUser();
user_box.style.display = 'none';
});
user_box.style.display = 'block';
}
if (loggedin) {
GetCurrentUser();
}
}, true);
};
내가 무슨 일이 일어나고 있는지 확인하기 위해 거기에 로그 메시지를 가지고 있지만, 그것은 단지 내가 "로그인 상태 얻기"를 한 후 메시지를받을 크롬에있다.
감사합니다. Andrew.
감사 내부보십시오. Firefox에서 로그 메시지가 나타나지 않았지만 크롬에서는 아무 것도 변경되지 않았습니다. 따라서 firefox/ie가 FB 객체를 얻지 못하는 것처럼 보입니다. 그다지 확실하지 않은 이유. –