开发者

Facebook Like Button on iFrame-based FB Pages App - Problem

开发者 https://www.devze.com 2023-04-02 07:41 出处:网络
I\'m experiencing problems adding a like button to an iFrame based page within my FB fan pages tabs. I\'m using the JavaScript SDK and the Open Graph to specify the page I\'d like the user to \"like\"

I'm experiencing problems adding a like button to an iFrame based page within my FB fan pages tabs. I'm using the JavaScript SDK and the Open Graph to specify the page I'd like the user to "like" (which is the current page within my FB pages).

The page is iFrame based, is an app in FB, and is accessed via the FB Page tabs of my FB Page. The problem is that Facebook is assigning the Like to my FB Page itself (my FB page homepage if you will) rather than the page In question (my test page – it’s set up as an app and appears in my FB Pages tabs under the name “og test”).

I’ve tried running the target page for the iFrame through the FB linter and its giving a strange error saying I’ve supplied the Open Graph Type of “Other” (I haven’t, I’ve supplied “website” in my META tag) see below:

http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.airport-parking-quote.co.uk%2Ffacebook%2Fog-test.php

Also, from looking at the debug page it seems that Facebook is either ignoring the QueryString in my “og:url” value and therefore only seeing my FB page’s vanity URL, or there is some kind of block on being able to Like iFrame based app pages.

Can anyone shed any light on this? I thought from this article it would be possible to achieve what I am trying to do:

http://www.insidefacebook.com/2010/09/09/like-buttons-app-content/

The code for the iFrame target page is:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
  <head>
    <title>Test Like</title>
    <meta property="og:title" content="OG Test"/>
    <meta property="og:type" content="website"/>
    <meta property="og:url" content="https://www.facebook.com/EssentialTravel?sk=app_275969292428556"/>
    <meta property="og:image" content=""/>
    <meta property="og:site_name" content=""/>
    <meta property="fb:admins" content="100002424161307"/>
    <meta property="fb:app_id" content="275969292428556"/>
    <meta property="og:description" content="OG test through canvas page"/>
  </head>
  <body>
  <div id="fb-root"开发者_运维技巧></div>
  <script src="http://connect.facebook.net/en_US/all.js"></script>
  <script>
    FB.init({
      appId  : '275969292428556',
      status : true, // check login status
      cookie : true, // enable cookies to allow the server to access the session
      xfbml  : true, // parse XFBML
      oauth  : true // enable OAuth 2.0
    });
  </script>
    Test Page<br>
    <script src="http://connect.facebook.net/en_US/all.js#appId=156081301143077&amp;xfbml=1"></script><fb:like href="https://www.facebook.com/EssentialTravel?sk=app_275969292428556" send="false" width="450" show_faces="false" action="recommend" font=""></fb:like>
  </body>
</html>

Anybody have any ideas?

Thanks,

Pjordanna


Unfortunately you can't set up a like button for an actual tab on a page.

As you have found out, trying to make a like button using a url such as https://www.facebook.com/EssentialTravel?sk=app_275969292428556 will just make a like button for the page not the individual tab.

The best way to make a like button for that specific tab would be to just use the URL of the app sitting on your server eg. http://YOURDOMAIN.com/YourAppDirectory

0

精彩评论

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

关注公众号