انقطاع جزئي للخدمةshare-external
Facebook like button not working
1

I have an old iframe like button on my product page which is no more working. I just updated my implementation to use the facebook SDK but still getting the same error: The loading of “https://www.facebook.com/plugins/like/connect” in a frame is denied by “X-Frame-Options“ directive set to “deny“.

I have the initialization code and everything setup correctly but not sure why it isn't working. Any help will be highly appreciated. Thanks in advance!

Nadeem
تم طرح السؤال منذ حوالي ‏٦‏ أشهر
الإجابة المحددة
1

Here is the code using JS SDK that might help you.

‏٢٨ يونيو‏‏١:٥٤ م‏111
Nadeem
Nadeem

Make sure you are logged in to facebook on same window to make it work.

‏٢٩ يونيو‏‏٣:٠٢ ص‏111
Daniel

Thanks man, but nope! That's the same code I'm using, and after I click the like button this happens:

https://drive.google.com/file/d/1k-y7IzEr4s9NNmrIFYr5tmsRpFFvG0r4/view?usp=sharing

The whole thing disappears. I also tried removing twitter and pinterest buttons, just in case, but the same error still happens. Many people asked me what I use those buttons for, since almost no one uses them anymore, but I'm old-fashioned haha.

‏٢٩ يونيو‏‏٩:٤٩ م‏111
Nadeem

@Daniel Are you testing with facebook logged in in same browser? Also, are you using the live domain? It will not work with localhost. It is working for me partially. That is, it is working for some of the product pages but not working for others. I am not sure why it is behaving like this.

And yes, I think no one use this but we have this on every product page. So we need to fix this.

‏١ يوليو‏‏١:٣٣ ص‏111
Nadeem

May be it takes time to register the like event?

‏١ يوليو‏‏١:٣٧ ص‏111
Nadeem

I have also added og meta tags e.g.

‏١ يوليو‏‏١:٣٩ ص‏111
2

Could you fix this problem? It's happening to me too. Also, when I click "like", both the like and share buttons break and dissapear. Editing my .htaccess file and changing X-Frame-Options to "sameorigin" didn't help at all either.

‏٢٠ يونيو‏‏٦:١٧ ص‏111
Daniel
Nadeem

They just don't reply to any post. Nice to hear from meta team!

‏٢٠ يونيو‏‏٧:٣٢ ص‏111
Daniel

I was reading in different threads and apparently this problem has been happening for more than 8 months, and they still haven't solved it. Unbelievable.

‏٢١ يونيو‏‏٦:٥١ ص‏111
Nadeem

Yes, that is correct. I also found many related threads but no one even replied from the facebook development team which is really frustrating.

‏٢١ يونيو‏‏٨:٠٢ ص‏111
Daniel

I know, man. You know, there's an official community on Facebook: https://www.facebook.com/groups/146797922030397

I published a question there, but the administrators deleted it without giving any explanation. It seems totally disrespectful to me, but hey, maybe you'll have better luck.

‏٢١ يونيو‏‏٨:٥٧ م‏111