当我使用此代码时,它显示在我的“default.aspx”页面上登录的Facebook用户个人资料图片,我不想要。我想要的是允许用户登录,重定向到我的应用程序,然后访问公共个人资料信息。有没有办法在这里压制个人资料图片。
<html>
<head><title>FaceBook Login</title></head>
<body>
<div>Welcome</div>
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function () {
FB.init({
appId: 'xxxxxxxxxxxxx',
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true // parse XFBML
});
FB.Event.subscribe('auth.authResponseChange', function (response) {
// Here we specify what we do with the response anytime this event occurs.
if (response.status === 'connected') {
testAPI();
} else if (response.status === 'not_authorized') {
FB.login();
} else {
FB.login();
}
});
};
// Load the SDK asynchronously
(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));
function testAPI() {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function (response) {
//var str = JSON.stringify(response) + " ";
//console.log(str);
//alert(str.toSource());
alert(response.id);
//console.log('Good to see you, ' + response.name + '.');
});
}
</script>
<fb:login-button show-faces="true" width="200" max-rows="1"></fb:login-button>
</body>
</html>