0
Fb.getLoginStatus를 사용하여 Js가 다른 페이지로 리디렉션되도록 구현하려고합니다. 사용자가 내 웹 사이트에 와서 Fb 앱에 연결할 때 Facebook에 로그인 한 경우. 그것은 작동하지 않고 나는 왜 모른다! 이것이 가능한가? 모든 조언을 기꺼이 받아 들일 것입니다.getLoginStatus를 사용하여 Js 리디렉션을 실행하십시오.
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : 'my-app-id',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
channelUrl : 'http://www.jamesherlihy.com/sandbox/fb-channel.html', // Custom Channel URL
oauth : true //enables OAuth 2.0
});
};
(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);
}());
FB.getLoginStatus(function(response) {
/* if user is logged in to Fb and connected to Soulmap, redirect them to logged-in homepage */
if (response.authResponse){
window.location = "http://www.jamesherlihy.com/fb-03-logged-in.php";
}
/* if user is NOT logged in to Fb and/or connected to Soulmap, do not execute any script */
});
</script>
안녕하세요, 안녕하세요. 응답 해 주셔서 감사합니다. 이전에는 그만 두었던 것이 좋지만,이 경우에는이 스크립트 바로 앞에 페이지에 '
'이 있습니다. 이 경우에는 그렇지 않습니다. – Jamespublic다른 간단한 Js 명령으로 테스트 중이므로 getLoginStatus 함수가 저에게 맞지 않는 것으로 보입니다. – Jamespublic