简体   繁体   中英

Facebook like button posting wrong url to wall

I have a facebook app displayed on my page via an Iframe . I have included the following code on my page to generate the like and comment block .

<div class="my_page_footer">
 <script src="https://connect.facebook.net/en_US/all.js"></script>
  <div class="my_page_likes">
    <fb:like href="<?=$canvas_url;?>" show_faces="true" width="570" font="verdana"></fb:like>
  </div>
  <div id="fb-root"></div>
  <div class="my_page_comments">
    <fb:comments href="<?=$canvas_url;?>" num_posts="5" width="570"></fb:comments>
  </div>
</div>

Where the canvas url is the iframe src to my app. However when anybody clicks on Like the iframe src url is posted on their wall instead of the name of the app or the link to the app

Any thoughts ?

  • Neil

Facebook figures out what to display for a URL using Open Graph headers. For example:

<meta property="og:title" content="..." />
<meta property="og:url" content="..." />
<meta property="og:image" content=""..." />

You can use the OG debugger tool to figure out if your headers are setup correctly.

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