私は素晴らしいプロジェクトに取り組んでいます。通常は AS3 を使用していますが、現在は Javascript を使用しています。
次の情報があります。以下では、検出行にアクセスしようとしています。基本的に必要なのは検出(response.username)です。私は多くのことを試しましたが、誰か助けてもらえますか?
<div id="fb-root"></div>
<script type="text/javascript">
$(document).ready(function(){
var appId = "121070974711874";
// If logging in as a Facebook canvas application use this URL.
var redirectUrl = "http://apps.facebook.com/bggressive";
// If logging in as a website do this. Be sure to add the host to your application's App Domain list.
var redirectUrl = window.location.href;
// If the user did not grant the app authorization go ahead and
// tell them that. Stop code execution.
if (0 <= window.location.href.indexOf ("error_reason"))
{
$(document.body).append ("<p>Authorization denied!</p>");
return;
}
// When the Facebook SDK script has finished loading init the
// SDK and then get the login status of the user. The status is
// reported in the handler.
window.fbAsyncInit = function(){
FB.init({
appId : appId,
status : true,
cookie : true,
oauth : true
});
FB.getLoginStatus (onCheckLoginStatus);
};
(function(d)
{
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
function onCheckLoginStatus (response)
{
if (response.status != "connected")
{
top.location.href = "https://www.facebook.com/dialog/oauth?client_id=" + appId + "&redirect_uri=" + encodeURIComponent (redirectUrl) + "&scope=user_photos,friends_photos";
}
else
{$
// Start the application (this is just demo code)!
$(document.body).append ;
FB.api('/me?fields=username', function(response) {
function detect(URL) {
var image = new Image();
image.src = URL;
image.onload = function() {
var result = 'result'; // An example result
}
document.body.appendChild(image)
}
detect("https://graph.facebook.com/" + response.username + "/picture?width=200&height=200");
});
FB.api('/me/friends?fields=id,first_name', function(response) {
var randomFriend = Math.floor(getRandom(0, response.data.length));
gFriendID = response.data[randomFriend].id;
var randomFriend = Math.floor(getRandom(0, response.data.length));
gFriendID2 = response.data[randomFriend].id;
function friend1(URL) {
var image = new Image();
image.src = URL;
image.onload = function() {
var result = 'result'; // An example result
}
document.body.appendChild(image)
}
friend1("https://graph.facebook.com/" + gFriendID + "/picture?width=200&height=200");
function friend2(URL) {
var image = new Image();
image.src = URL;
image.onload = function() {
var result = 'result'; // An example result
}
document.body.appendChild(image)
}
friend2("https://graph.facebook.com/" + gFriendID2 + "/picture?width=200&height=200");
});
}
}
});
</script>