Delashmate
Delashmate

Reputation: 2424

How to start new facebook web application

I made in the past desktop application for facebook (in c# winform), Now I have idea for another application, I already did a prototype for it, And I want to write it on facebook web application

I will write it with C#, so please be focus on that language

Thanks,

Dan

Upvotes: 3

Views: 834

Answers (1)

Rune Aamodt
Rune Aamodt

Reputation: 2611

You should probably base it around the Facebook JavaScript SDK, at least that's what the Docs recommend these days. A really simple "Hello User" type app (really just a simple webpage) could look something like this:

<html><body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
   appId  : 'YOUR APP ID',
   status : true, // check login status
   cookie : true, // enable cookies to allow the server to access the session
   xfbml  : true  // parse XFBML
});
FB.getLoginStatus(function(response) {
  if (response.session) {
    FB.api('/me', function(api_response) {
      document.getElementById("usr-name").innerHTML=api_response.name;
      document.getElementById("app-content").style.display="block";
    });
  }
  else {
    alert("not logged in!") ;
  }
});
</script>
<div id="app-content" style="display:none">
Hello <span id="usr-name"></span>!
</div>
</body></html>

Hope this helps!

Upvotes: 4

Related Questions