Myat Su
Myat Su

Reputation: 43

How to add Facebook Like Button in desktop application?

I would like to know how to add Like button in VB.NET winforms application. I created index.html which include iframe to call Facebook Like Button Now I used WebBrowser Control to show Facebook Like Button. It appear in my form and can login with Facebook account the problem is Like Count is not increase, please help me!!!

This is sample code I used

index.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title></title>

</head>
<body>
<iframe src="http://www.facebook.com/plugins/like.php?href=https%3A%2F    %2Fwww.facebook.com%2Fchequeprintingsoftware&amp;send=false&amp;layout=standard&    amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&    amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>



</body>
</html>

VB.NET

Private Sub frmFaceBookLike_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim html As String
        html = File.ReadAllText(Application.StartupPath & "\index.html")
        WebBrowser1.DocumentText = html
End Sub

Upvotes: 3

Views: 2022

Answers (1)

Rudi Mk
Rudi Mk

Reputation: 152

The Like button was designed for use in web environments - you know, the page is hosted on a server, Facebook can scrape the URL, and so on. The way you've implemented the Like button is rather innovative - but ultimately, it won't really work, as you can see - in your case, the count isn't increasing.

A better solution, is to use the Open Graph, and have your own implementation of the Like button. In such a scenario, you'd use the Facebook C# SDK, and use the Like action provided by the Open Graph, to create your own Like button. You can find more details about the Open Graph's Like action here.

Upvotes: 2

Related Questions