How get facebook avatars use https protocol?

523 Views Asked by At

I use old FB API in my project.

For showing FB avatar I use facebooker gem in my Rails app. I user facebooker method "fb_profile_pic(owner, {:linked => false, "facebook-logo" => :true}". He generate this FBML:

<fb:profile-pic facebook-logo="true" height="73" linked="false" size="square" uid="1440313044" width="73" style="width: 73px; height: 73px; " class=" fb_profile_pic_rendered"><img src="http://external.ak.fbcdn.net/safe_image.php?d=d5eee08e09b7573d93b61f82ac11feda&amp;url=http%3A%2F%2Fprofile.ak.fbcdn.net%2Fhprofile-ak-snc4%2F41642_1440313044_4069_q.jpg&amp;logo&amp;v=5" alt="Shaliko Usubov" title="Shaliko Usubov" style="width:73px;height:73px;" class=""></fb:profile-pic>

If I display this avatar on the page which is available at https protocol - getting error

"The page at https://my_domain.com/ displayed insecure content from http://external.ak.fbcdn.net/safe_image.php?..."

How can I get FB avatar with HTTPS protocol?

1

There are 1 best solutions below

0
asdf_enel_hak On

/* ATTENTION BELOW */ says if your your app https then fb javascript libary will be https.

You may check in your code

  window.fbAsyncInit = function () {
            FB.init({ appId: /*123456789*/', status: true, cookie: false, xfbml: true });
        };
        (function () {
            var e = document.createElement('script'); e.async = true;
            /* ATTENTION BELOW */
            e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; 
            document.getElementById('fb-root').appendChild(e);

        } ());