📜 ⬆️ ⬇️

Facebook API: fixing a broken Like button on a site

Yesterday, colleagues pointed out a broken Facebook button "Like" on the site.


image


Got to look.



The result is very sad and strange:



Three options:


  1. broke themselves
  2. only we broke (like this - " Facebook Admin Page doesn't load properly " when you need to write Facebook calipers and they fix it in a couple of days)
  3. broke all

I checked and rejected the first one, voluntarily decided to discard the second one and started working based on the third option.


Checking a few obvious technical problems with our site and access to Facebook, I go to check the correctness of the button itself. Little did they break the API or something else.


image
(screenshot taken in Firefox and after fixing the problem)


I open the frame and see if there are any errors in the headers or javascripts


image


The eye clings to the roughness - http: // instead of https: // at the address of the facebook page, the fingers correct themselves and ...


image


Conclusion:


The https://www.facebook.com/plugins/**like.php button configured on the facebook page does not work only if the page address is specified with http: //, and not https: // **


It remains to check whether this is a bug or a feature - we study the behavior of the panel (the one with subscribers) https://www.facebook.com/plugins/likebox.php . Whether it behaves in the same way as a button (works only with https: //) or not.


image
The result - it continues to work with http: // and https: //.


Conclusion:



Half an hour to identify the problem, ten minutes to fix on all affected sites. We drove and forgot.


And in the morning it turns out that the problem is not only with us. This confirms the correctness of the initial choice in favor of "broke at all" and prompts to go to write this text.


PS If this problem has other manifestations and solutions, then write in the comments. I will supplement the text.


')

Source: https://habr.com/ru/post/325856/


All Articles