最投票回答修改host文件我已經改變了我的網站名稱未住域,但在我的本地域名所有堆棧溢出的解決方案仍然無法FB登錄我的本地主機服務器
127.0.0.1 localhost
127.0.0.1 localhost/great
後後這個我做了測試應用還fbdevelopers和變更域名到本地主機
並在此之後我有意見直播服務器上運行的應用程序的所有FB登錄碼和整合FB登入碼
function statusChangeCallback(response) {
alert("yes");
console.log('statusChangeCallback');
console.log(response);
if (response.status === 'connected') {
// Logged into your app and Facebook.
testAPI();
} else {
document.getElementById('status').innerHTML = 'Please log ' +
'into this app.';
}
}
function checkLoginState() {
alert("here");
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
}
window.fbAsyncInit = function() {
alert("ghhh");
FB.init({
appId : '1726174127690844',
xfbml : true,
version : 'v2.10'
});
FB.AppEvents.logPageView();
};
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
};
(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/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('Successful login for: ' + response.name);
document.getElementById('status').innerHTML =
'Thanks for logging in, ' + response.name + '!';
});
}
和FB登錄
<fb:login-button
scope="public_profile,email"
onlogin="checkLoginState();">
</fb:login-button>
<div id="status">
</div>
的按鈕,但仍然收到錯誤
Can't Load URL: The domain of this URL isn't included in the app's domain
請天才在那裏我錯了就糾正我,請您給我您的專家意見
嘗試使用「127.0.0.1 mytestdomain .com「,並在fb應用域上使用mytestdomain.com域 –
您要我編輯主機文件並將其更改爲great.com – qasu
是的,您應該在主機文件」127.0.0.1 great.com「中添加另一行,您的網站將可以在great.com/great(如果它在偉大的文件夾中) –