部分中斷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
已發問 約 6 個月前
已選擇的回答
1

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

6月28日下午1:54
Nadeem
Nadeem

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

6月29日上午3:02
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.

6月29日下午9:49
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.

7月1日上午1:33
Nadeem

May be it takes time to register the like event?

7月1日上午1:37
Nadeem

I have also added og meta tags e.g.

7月1日上午1:39
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.

6月20日上午6:17
Daniel
Nadeem

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

6月20日上午7:32
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.

6月21日上午6:51
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.

6月21日上午8:02
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.

6月21日下午8:57