我有一个相册,我想在网站上展示给任何访问者。目前我正在使用 FQL 显示专辑,但它仅在我登录到我的帐户时显示给我。有没有人知道验证公共用户甚至没有 Facebook 帐户的人来查看专辑的方法?
当前代码:
var fbAppId = 'xxxxxxxxx';
window.fbAsyncInit = function() {
FB.init({
appId : fbAppId, // App ID
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse page for xfbml or html5 social plugins like login button below
});
};
(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/all.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function getPhoto() {
FB.api(
{
method: 'fql.query',
query: 'SELECT src_big, src FROM photo WHERE album_object_id = "[my album id]"'
},
function(response) {
if (!response || response.error) {
console.log(response.error);
} else {
console.log(response);
for (var i = 0; i < response.length; i++) {
$('#result').append('<img src=' + response[i].src + ' alt="" /> ');
}
}
}
);
};