Я пытаюсь узнать логин на Facebook и узнать, как я могу интегрироваться в asp.net
проект MVC.Во-первых, я пытаюсь узнать, в обычной HTML-версии на моем веб-сайте я использовал кнопку входа в Facebook из документов.Но когда моя страница загружена, требуется 1 или 2 секунды, чтобы показать мою кнопку Facebook.Как я могу решить эту проблему.Мой код:
<!DOCTYPE html>
<html>
<head>
<title>Facebook Login JavaScript </title>
<meta charset="UTF-8">
<body>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '2194615170807288',
autoLogAppEvents : true,
xfbml : true,
version : 'v3.2'
});
// 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 = 'https://connect.facebook.net/tr_TR/sdk.js#xfbml=1&version=v3.2&appId=2194615170807288';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function checkLoginState() {
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
}
function statusChangeCallback(response) {
// The response object is returned with a status field that lets the
// app know the current login status of the person.
// Full docs on the response object can be found in the documentation
// for FB.getLoginStatus().
if (response.status === 'connected') {
// Logged into your app and Facebook.
FB.api('/me?fields=id,first_name,last_name,email', function(response) {
document.getElementById("fname").value = response.first_name;
document.getElementById("lname").value = response.last_name;
document.getElementById("email").value = response.email;
});
}
else {
document.getElementById("fname").value ="";
document.getElementById("lname").value ="";
document.getElementById("email").value ="";
}
}
</script>
<div>
<form>
First name:<br>
<input type="text" name="firstname" id="fname"><br>
Last name:<br>
<input type="text" name="lastname" id="lname"><br>
Mail:<br>
<input type="text" name="mail" id="email"><br>
</form>
</div>
<div class="fb-login-button" data-max-rows="1" data-size="large" data-button-type="continue_with" data-show-faces="false" data-auto-logout-link="false" data-use-continue-as="true" scope="public_profile,email" auth_type="rerequest" onlogin="checkLoginState();"></div>
<fb:login-button scope="public_profile,email" auth_type="rerequest" onlogin="checkLoginState();">
</fb:login-button>
</body>
</html>