1

So I've done some google'ing and I couldn't find a good answer to this.

I use the following code to allow my users to post a status update to their fb:

<html>
<head>
  <title>My Great Website</title>
</head>
<body>
  <div id="fb-root"></div>
  <script src="http://connect.facebook.net/en_US/all.js">
  </script>
  <script>
     FB.init({ 
        appId:'**', cookie:true, 
        status:true, xfbml:true 
     });

     FB.ui({ method: 'feed', 
        message: 'Facebook for Websites is super-cool'});
  </script>
 </body>

Code works fine, however I want to get rid of that horrible looking border and set the width. I heard this isn't possible because of "origin policy" but is it possible to be done with Javascript? Or, can I mimic the plugin above with my own custom script that will still post to FB but I will have more control over it?

bkaid
  • 51,465
  • 22
  • 112
  • 128
Charlie
  • 11,380
  • 19
  • 83
  • 138

1 Answers1

2

You could always build your own JS components and then use the JS-SDK FB.api() method:

function post_message(body) {
    FB.api('/me/feed', 'post', { message: body }, function(response) {
        if (!response || response.error) {
            alert('Error occured');
        } else {
            alert('Post ID: ' + response.id);
        }
    });
}

But then, this would require the user to actually "connect" to your app.

ifaour
  • 38,035
  • 12
  • 72
  • 79
  • So I'd have to use Facebook connect along with it? – Charlie Aug 27 '11 at 23:53
  • Yes, as you can see `me` = current *connected* user. The only way to post on a user's wall *without* being connected to your app is by using the Facbeook plugins or dialogs which you don't have control on how they look – ifaour Aug 27 '11 at 23:56
  • So it would look like this. I would display a text box with a post button and a connect with Facebook button. When the user pressed the connect button it would connect their account with my app. Then it would populate the `me` with their user id. All they would have to do them was type and press submit? – Charlie Aug 28 '11 at 02:35
  • What do you mean by *pre-made*? I thought you want to create your own to have a custom styling? – ifaour Aug 28 '11 at 18:06
  • I do, I'm just not spectacular with coding in PHP. But I can probably figure it out.. – Charlie Aug 28 '11 at 21:30