开发者

Style certain elements of FB.ui?

开发者 https://www.devze.com 2023-03-31 10:18 出处:网络
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:

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 W开发者_运维问答ebsite</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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号