Łukasz Kropidłowski
Łukasz Kropidłowski

Reputation: 11

like button for application

I have a question, how to put like button" on the application on facebook example:

<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/pl_PL/all.js#xfbml=1&appId=94784739294";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-like" data-href="http://www.facebook.com/teste?sk=app_09090909" data-send="true" data-width="450" data-show-faces="true"></div>

If you use this form http://www.facebook.com/teste?sk=app_09090909 this brings me to http://www.facebook.com/teste. Why ?

Upvotes: 0

Views: 373

Answers (3)

user1107108
user1107108

Reputation: 65

facebook gives three options, i tried the third one ,used an i-frame and worked for me easily..

<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fapps.facebook.com%2FYOURAPPNAME%2F&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font&amp;height=80&amp;appId=XXX" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>

Upvotes: 1

Juicy Scripter
Juicy Scripter

Reputation: 25918

It's actually related to fact that page you're trying to like is Facebook Page (and the parameters you pass just indicate that Page Tab application should be displayed instead of default view).

Linter doesn't even try to fetch OpenGraph tags from your application. Once linter visit that page it'll discover that og:url for that page still pointing to the Facebook Page and not to your Application running in Page Tab, and this seems OK (you application doesn't own that page but Facebook Page does)...

The solution is to create intermediate page that will hold desired OpenGraph tags and doing client-side redirect to final page. URL of that page should be used for Like Button social plugin to provide correct details in stories published by liking but still drive users to correct final page.

Upvotes: 0

Laurent
Laurent

Reputation: 987

It seems like the like button doesn't care about page's variables after the "?".

The hack I found is to use a data-href with another URL you own, and redirect it to your real app URL.

I don't like this so much, why facebook does not allow to like pages?

Upvotes: 0

Related Questions