简体   繁体   中英

Post my website to facebook wall

I would like to embed a facebook button on my website so that users can post the page to their facebook wall.

在此处输入图片说明

Something like this.i cant find a good tutorial for this.How to embed this and make it possible by using javascript?I have already made the facebook app and got my app ID.Dont know what to do next.Any help?

I did this for the first time today.

The next step will be adding the open graph values as meta tags in the head element page. As, someone else pointed out, this information can be found on the developers Facebook reference page. Make sure you put the "Facebook script" after the body tag or you will get a whole bunch of errors and it will not work.

Once your finished, you can use Facebook's debug tool to test if it's working properly (also available in developer section).

Again, you will need to make sure you put the "Facebook script" after your body tag or this will not have any effect on how your page posts.

<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=258515144314430";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Then put this in your head element.

<head>
    <title>Hello World!</title>
    <meta property="fb:app_id" content="000000000000">
    <meta property="og:title" content="Hello World">
    <meta property="og:site_name" content="The Wonderful World of Hellos">
    <meta property="og:url" content="http://blahblahblah.com">
    <meta property="og:description" content="Check out how to say hello to the world!">
    <meta property="og:image" content="http://link-to-image.jpg">
</head>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM