简体   繁体   English

向未登录的用户显示网站上的Facebook照片

[英]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.

相关问题 未登录的用户看不到创建帖子按钮/发送消息按钮的帮助 - Assistance in having create post button / send message buttons not be visible to users who aren't logged in 显示所有登录的用户 - Display all logged in users 使用Facebook登录后重定向用户 - redirect users after logged in with facebook 想像我的网站一样在我的网站上向下显示人名或照片旁边的图像 - want to display images next to people's names or photos on my website down to down like facebook 如何向打开Chrome控制台的用户显示警告,例如Facebook和Blockchain? - How can I display a warning to users who open the Chrome console, like Facebook and Blockchain does? Facebook不允许访问用户上传的照片的权限 - Facebook not giving permission to access users uploaded photos Facebook登录名(Web)无法看到通过Facebook设备应用程序登录的用户 - Facebook login (web) can't see users logged in by the facebook device app Facebook动态像网站上的照片按钮 - Facebook dynamic like button for photos on website EmberJS + EmberFire:如何根据登录网站的用户数显示/隐藏模式 - EmberJS + EmberFire: How to display/hide modal based on the number of users logged to website 用javascript api显示facebook上的照片? - display photos from facebook with javascript api?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM