If user is not logged to facebook then clicking on Like Button opens a popup window prompting for user to login. I don’t want that popup to display – hence the best would be to not show Like button for visitors that are not logged to Facebook.
Is it possible?
Yes and no. It is possible when your facebook application is not shown in a tab because in a tab facebook runs no javascript and no user information is passed until the user clicked somewhere.
If you are writing a “real” facebook app, you could try the following code, I do this in PHP like this:
If this code returns “0”, a guest is viewing the application.