Facebook button count on my site via javascript - facebook

I´m trying to place a Facebook button - count on a site.
I´m building the site all the way through javascript.
So I´m adding an iframe inside a div (created through javascript) created used createElement('iframe'). I´ve added the iframe properties as the code I got from facebook page.
The problem is:
In the src iframe property, I have layout setted as 'button_count' (as I want a button_count layout for the site), but it appears as 'standard' layout.
Any help?
Thanks :)

I´ve just changed the src to another one and now it works :)

Related

adding facebook share button in gwt application

I have been working with gwt and gxt since around few months,
I am working on a web site which needs to interact with social media web site like facebook,
I am trying to add fcebook share button in my web site , i tried below way -
I tried using HTML -
HTML facebookButton = new HTML();
facebookButton.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
facebookButton.setHTML("<div class=\"fb-share-button\" data-href=\"https://developers.facebook.com/docs/plugins/\" data-layout=\"button\" data-size=\"small\" data-mobile-iframe=\"true\"><a class=\"fb-xfbml-parse-ignore\" target=\"_blank\" href=\"https://www.facebook.com/sharer/......src=sdkpreparse\"> <img src=\"img/social/facebook.png\" > </a></div>");
But it does nothing -
tab.getUrlHeader() - this what i want to share
i searched across , but could not find anything .
is it possible to create such button in gwt/gxt by any way ..?
any help is appreciated
facebookButton.setHTML("<div class=\"fb-share-button\" data-href=\"https://developers.facebook.com/docs/plugins/\" data-layout=\"button\" data-size=\"small\" data-mobile-iframe=\"true\"><a class=\"fb-xfbml-parse-ignore\" target=\"_blank\" href=\"https://www.facebook.com/sharer/......src=sdkpreparse\"> <img src=\"img/social/facebook.png\" > </a></div>");
i think this what you copied from facebook share button -
This is correct , can't understand why this is not working for you.
You can try the iFrame approach. It is simple and easy.
I guess you have already created the facebook APP id from your developer account.
go to this page -
https://developers.facebook.com/docs/plugins/share-button
then enter the url you want to share -
URL to share
also choose the layout and the button size -
Layout-
Button Size-
Then click on Get Code - You will get the pop up.
In this pop up go to iframe tab - and copy the iframe element.
Then you can set this in your Html Label in GWT like this.
facebookButton.setHTML("<iframe src=\"https://www.facebook.com/plugins/share_button.php?href=......");
Let me know if it works

How to modify facebook canvas page?

I am making a game with Unity3d for facebook.
Is it possible to add anything else but the unity3d binary on the facebook canvas? Like background image, external advertisement banner etc. ?
Earlier there were more options, but nowadays you can only set you .unity3d file in the settings.
There are very limited options in facebook developer pages for modifying your canvas page, so I guess the page modification has to be done somewhere else?
I also tried Unity´s own webPlayerTemplate but that does nothing.
Facebook canvas is just an iFrame meaning what ever you put in the web page of the game will be displayed in there.
You can add anything by editing the html page that comes as output from the webplayer build. Easy solution to try opening the html page in dreamweaver or similar and start adding elements and see if it comes in the output. Be cautious there are chances that the html content gets rendered behind the game.
PS: one problem with untiy's web player build it that it always gets rendered above the html contents in the page.
Thank you for your answer!
I forgot to mention this:
When making a game on facebook without "facebook SDK for Unity" you can set the canvas as a webpage.
Then the canvas can be modified with the html. I tried that and it works just fine.
But when your app is using facebook SDK you can only include .unity3d file URL and the html file is completely ignored.
PS: after some more studies it seems you can inject html commands with Application.ExternalEval()
basicly anywhere inside your unity project by:
string injection = "lines to be executed on your canvas page";
Application.ExternalEval(injection);

Facebook Send button does not show up on Gwt popup panel?

I'm trying to get Facebook send or like button display on GWT popup panel and I am not successful. When inspecting the generated HTML, facebook HTML button looks properly inserted into but it just does not show up. Save Facebook button works well in html page (not on GWT panel).
Have you ever had success in displaying Facebook Send or Like or Share button in GWT? I know I ca implement FB Like button myself using API or other libraries. But I do it need that. I need standard Facebook Send button to be used in my GWT application.
Please advise me if you have experience and were successful.
Thank you very much!
I had a similar problem, and it was because, in the html file's script tag, I had changed and not updated the src="path" to a valid path. I had a wrong directory listed in the path. For me, it's correct now with:
<script type="text/javascript" src="clienttest/clienttest.nocache.js"></script>
I rebuilt, and the image appeared on the page. This problem was keeping the entry point module from loading.

<fb:comment> tag not working properly

I have a GWT app and Im trying to put fb social plugin comment in side of my page. However I have the folowing problem.
If I put the tag in my .html it works perfect, but If I put id dynamically (like with an HTML widjet), It does not work. It just does not display anything.
Can anyone help me? Im having this problem in general, not only with the fb:comment tag.
Note: If I use the iframe implementation of, for example, "fb:like", it works perfect.
My understanding of facebook's api is that it loads your content, and parses out the tags in the fb namespace, replacing them before the actual content is drawn for the user. In contrast, none of the GWT compiled code (or indeed any Javascript code) gets a chance to make changes to the dom until the page has loaded in the browser fully, after facebook has made the changes it needs to.
My advice: Put the fb namespaced tags on the initial page, but perhaps wrap them in a div and mark them as display:none. Then you can grab them from your GWT code and wrap them up in a widget, only to be displayed when you are ready.

FB.provide is not a function

I'm developing a WordPress plugin to show above or bottom the posts Facebook like and send buttons.
Unfortunately when is also activated a plugin for Facebook share button there is a Javascript error (FB.provide is not a function) and like and send buttons don't appear.
For example this happens in this page: http://www.pasqualepuzio.it/2011/04/plugin-facebook-like-and-send-button/
How can I solve this issue?
Thank you very much
I ´ve faced the same problem and it happens if you add the script twice on the site (http://connect.facebook.net/sv_SE/all.js)
I understood that part that we cant have all.js twice but I want to have Facebook Share Button and Facebook Like Button.
According to Docs, I need to include these two JS Files.
https://connect.facebook.net/en_US/all.js
http://static.ak.fbcdn.net/connect.php/js/FB.Share
Now, If I include both Firebug will give me same error "FB.provide is not a function". If I remove either of them then Like or Share button wont work.
I can do iFrame version but I have HTML Encoding issues with iFrame Version. I am programmatic generating HTML Response.
Any idea, how to approach?
There is a workaround for this: instead of placing the javascript Fb.Share within the same page where you are loading the Javascript SDK, use an Iframe with the first and set it in the second.