Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook 'like button' return X-Frame-Options Deny

I'm trying to put a facebook 'like button' on each post of a blog. The code was pasted correctly, but i'm getting this error:

Refused to display 'https://www.facebook.com/undefined/plugins/like.php?action=recommend&app_id…%2F&layout=button_count&locale=pt_BR&sdk=joey&share=false&show_faces=false' in a frame because it set 'X-Frame-Options' to 'DENY'.

There is a 'undefined' after facebook.com/, and i don't know why.

Any idea how to solve this issue?

like image 919
cbaracat Avatar asked Dec 26 '22 09:12

cbaracat


2 Answers

This is unfortunately a bug in how the JS SDK does implicit initialization (the init params in the url), so you're doing everything correct.

A fix is being prepared, but for now, you can use /en_US/all.js instead of /en_US/sdk.js.

like image 82
Sean Kinsey Avatar answered Jan 28 '23 22:01

Sean Kinsey


Old topic but a new problem - see also the new comment from @gkpo

Sorry, I can't comment (low reputation) but I tried several things to resolve the Facebook 'Like Plugin' issue.

The Facebook like.php returns a DENY for X-Frame-Options.

So I tried to renew the script Facebook plugin like. -> Does not work.

I tried setting up X-frame options for my page (allow Facebook). -> Does not work.

Then I tried to link my page with Facebook business manager (there is an option to link pages with verification). I thought this is the solution because the like button was back, but the secret was my Facebook login.

The plugin does not return DENY if you are logged into Facebook.

like image 40
Michael Avatar answered Jan 28 '23 23:01

Michael