问题
I am trying to trigger the "Like" action to a url by the visitor (if they're logged into facebook) from the user clicking on a button that's on my site. I don't want to embed the facebook like button otherwise the user would have to take two separate actions (e.g. click on my button AND click on the facebook like button). Is there a way to do this?
回答1:
There is no way to do this that won't get you penalized by Facebook if they find out.
This is intentional to prevent clickjacking and like-worms.
The only alternative would be creating a Facebook App, have the user give you the right to write to his wall and like and then use the Facebook API to directly like your page. However this would be many more steps than the above.
The Facebook like button features quite a few variations. The easiest way would be to pick the one among them that fits your design best and replace your button with it.
来源:https://stackoverflow.com/questions/6365205/how-can-i-trigger-facebooks-like-action-without-using-facebook-like-button