[英]Display facebook photos on a website to users who aren't logged in
I have a photo album I want to display on a website to anybody who visits. 我有一本相册,想在网站上显示给所有访问者。 At the moment I'm using FQL to show the album but it only shows to me when I'm logged in to my account.
目前,我正在使用FQL来显示相册,但只有在我登录帐户后才会显示给我。 Is there a way anybody knows of to authenticate a public user or even somebody without a facebook account to view the album?
有没有人知道对公众用户或什至没有Facebook帐户的人进行身份验证的方法?
Current code: 当前代码:
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="" /> ');
}
}
}
);
};
If you are okay using a third party facebook widget , a simple solution without any programming knowledge to displaying facebook photos on a website to users who aren't logged in by using 如果您可以使用第三方facebook窗口小部件 ,那么这是一种无需任何编程知识的简单解决方案,即可将未显示的Facebook照片显示给未使用的用户登录
<iframe src="http://facebookgalleria.com/gallery.php?id=nike&rows=4&margin=10&cols=3&width=170&font_size=11&title_color=000&hide_next_back=0&share_buttons=1&shape=rectangle&frame=1" scrolling="no" marginheight="0" frameborder="0" width="551" style="height: 769px;"></iframe>
Change 'nike' in the url to your facebook page username, copy the code and paste it on your html website editor and it'll display neatly. 将网址中的“ nike”更改为您的Facebook页面用户名,复制代码并将其粘贴到您的html网站编辑器中,它将整洁地显示。 Or customize your gallery at http://facebookgalleria.com .
或在http://facebookgalleria.com上自定义画廊。 However, if you display photos from your personal facebook account, you need to go to the website and connect with facebook first.
但是,如果您显示来自您的个人Facebook帐户的照片,则需要访问该网站并首先与Facebook建立联系。 Then you generate your code that will work on your website without your customers having to log in to see them.
然后,您将生成可在您的网站上运行的代码,而您的客户无需登录即可查看它们。
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.