I'm attempting to add a Facebook Like button to my website. I have the code in place and it's working on FireFox, but on Chrome it's not showing up.
For some reason when I'm working with the official Facebook like button 'creator' in Chrome, the like button will not show up when I change the URL from the default. It does however work in chrome.
I'm not sure what the problem could be, and it might be my code, so I'll add it below:
New HTML tag
<html xmlns:fb="http://ogp.me/ns/fb#" xmlns="http://www.w3.org/1999/xhtml">
Code for initializing the button (Copy pasted directly from Facebook
<!-- Facebook -->
<div id="fb-root"></div>
<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&status=0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
Code for the button (Also copy pasted directly from Facebook)
<fb:like href="https://www.facebook.com/wildblueberries" width="87" layout="button_count" show_faces="false" send="false"></fb:like>
Oh and if you would like to test out the problem this is the page on facebook that I'm trying to use to create the button: https://developers.facebook.com/docs/reference/plugins/like/ Try to change the "URL to Like" in Chrome. And the whole like button preview will vanish.
Update: Here is the link to the Facebook like button (It's created by their iFrame) This works in Firefox, but not Chrome/Safari: https://www.facebook.com/plugins/like.php?api_key&locale=en_US&sdk=joey&channel_url=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D26%23cb%3Df1732ea1fbdacbc%26origin%3Dhttp%253A%252F%252Fwildblueberries.com%252Fffb6e0ef554b96%26domain%3Dwildblueberries.com%26relation%3Dparent.parent&href=https%3A%2F%2Fwww.facebook.com%2Fwildblueberries&node_type=link&width=90&layout=button_count&colorscheme=light&show_faces=false&send=false&extended_social_context=false
Update 2 This problem only occurs if you're not logged into Facebook through your browser. Once I logged in the problem was fixed. Only problem is that not everyone in the world is logged into Facebook. So I'm still stuck with a broken Facebook like button. Any suggestions? - Thanks!
Update 3 After figuring out that only logged in users could see the like button, I searched Google and the fan page I'm linking to probably has demographic filters.
Update 4: After removing demographic filters from the fan page, the problem was fixed.
Related
I am currently writing a website for a local charity run preschool and they would like their Facebook feed on the site.
For this I have used the Facebook Pages plugin. Unfortunately, following their instructions, I don't get anything on the website.
I'm not getting any errors in the console, and the Facebook URL is valid.
I understand to view this specific page the user needs to be logged in to Facebook, which I am, and I'm also able to view the page in the same browser with no problems.
The code I have is:
<div id="fb-root"></div>
<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_GB/sdk.js#xfbml=1&version=v2.8&appId=261857213845517";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
and the HTML is:
< div class="fb-page" data-href="https://www.facebook.com/thevillageplaygroup/" data-tabs="timeline" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true">< /div>
(note, I've added spaces in the div opening and closing tags as I couldn't get it to show up otherwise, sorry).
I've tried changing the Facebook URL to https://www.facebook.com/facebook as in the examples and that works so I'm presuming it's something to do with the page itself but I can't find any privacy or security settings which seem relevant.
EDIT
The page has security restrictions in place which mean the user needs to be logged in to Facebook and in the UK.
My account is able to access it ok through Facebook, just not using the plugin on the website
Any help is greatly appreciated.
As pointed out by CBroe, it looks to be an issue with using the page feed for a page with privacy restrictions
“Facebook Pages with privacy restrictions cannot be embedded.”
I, wrongly, assumed that seeing as was logged into Facebook and could access the page that I would be able to see the feed. It seems Facebook disallow use of the plugin for pages with privacy restrictions regardless.
I am a beginner to facebook graph api.I have a facebook page,https://www.facebook.com/ILMISM .In my website I want to place button,so that whenever people click on that button they could like my page.I googled on it and watched many videos on youtube,though didn't get it properly.Finally I copied and pasted some code provided by facebook in my source file.That code is
<div id="fb-root"></div>
<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/sdk.js#xfbml=1&version=v2.3";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-page" data-href="https://www.facebook.com/ILMISM" data-hide-cover="true" data-show-facepile="false" data-show-posts="false"></div>
and I got output as shown in the following image.
But I don't want my output like this.So I want to edit this code as,
<div class="fb-page" data-href="https://www.facebook.com/ILMISM" data-hide-cover="true" data-show-facepile="false" data-show-posts="false"><img src="like us on facebook.png" /></div>
Then it is showing output as follows
Now whenever user clicks on on this button they could like my page.I am unable find an answer to how to achieve this?
Like CBroe's comment states, you cannot create some button which will make a user like your page instantly. you will have to use the page plugin.
There is one other solution, however, which only applies to web apps that implement a server side OAuth 2 login flow: Once your users are logged into your webapp, your server can publish a og.likes OpenGraph action on the user's behalf. You can implement this functionality anywhere in your app and make it look any way you want, but you should be aware that Facebook enforce their platform policy and branding policies.
For more information, please see the og.likes docs, especially the branding guidelines about this. Be aware that using any OpenGraph action in your app requires that you submit it for review, as documented here
Hi i'm trying to place a facebook like button in website With the following code
<div id="fb-root"></div>
<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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
FB.Event.subscribe('edge.create',
function(response) {
alert("Thank you for liking my page");
}
);
</script>
<div class="fb-like-box" data-href="https://www.facebook.com/mypage" data-width="292" data-show-faces="true" data-stream="true" data-show-border="true" data-header="true"></div>
But the FB.Event function not working when i tested, I think i can use this trigger event only if i use FB.init and running inside fbAsyncInit() function.this came to know by searhing web.
i don't know these things exactly.Now the problem is Fb.init require appId,channelUrl and few more.I'm confused i didn't created any Application and i'm not creating i'm just trying to place a facebook like button to my website then how come can i provide appId.
Can anyone explain me about this appId.Does it required to create like button and to create Fb.event when a user likes my page like thanking them or am i using the given code wrongly?
It is recommended to use an App Id for every Social Plugin (like the Like Button).
And here´s an overview of how you should implement the Facebook SDK:
https://developers.facebook.com/docs/javascript/quickstart
You better place that FB.Event code right where it says "Additional initialization code..." - Because right now, you are using "FB" when it´s not even initialized.
And this is where you can create an App: https://developers.facebook.com/apps
Here's some docs about the app id —
search for fb:app_id on this page: https://developers.facebook.com/docs/sharing/webmasters#markup
You specify the app id, so that you can use Facebook Domain Insights to view analytics for traffic to your website from Facebook. Apparently FB Domain Insights is some FB tool that webmasters can use to get information about how the content on their website get shared inside Facebook.
However the FB page about Facebook Domain Insights is gone ... and instead says you should look for some "platforminsights" tool. I suppose FB made some changes to their analytics stuff, recently.
I created a Facebook like button a year or so ago on their site (https://developers.facebook.com/docs/reference/plugins/like/).
The site is still up, and it shows the button on their site when I try to create it, along with how many people have already liked it.
However, on my site's homepage, I've spent hours trying to get it to show up, thinking it might have been a glitchy css misplacing it. However, looking across my site, all my like buttons no longer work, as I had like buttons for different songs on my site, exc.
I know it's not just me either, because a site with game mods I go to no longer shows the like button any longer, either, though their programming has not changed any.
So my question is if anyone knows of they changed their coding so that the coding at the link mentioned above no longer works, and what would be the new code?
Code I'm using:
In Head:
<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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
</HEAD>
In Body:
<div class="fb-like" data-href="http://www.alternategaming.net" data-send="false" data-width="450" data-show-faces="true" data-colorscheme="dark"></div>
Thanks for any information on this in advance... I'm wondering if it's my code, or if facebook just discontinued use....
Apparently, as of the time of that posting, the Facebook "Like" buttons have a problem with showing up on Google Chrome. I went to another site, and they didn't show up either, until I went there using Firefox.
Long story short: unless Facebook or Chrome fixes something, "Like" buttons don't work off of Facebook in Google Chrome; for anyone else with this problem to know. :)
Is there a simple URL string that Facebook will accept to "like" a site... or more accurately (as a commenter points out below), share a site? As a comparison, Twitter allows you to post from any page simply by pointing an anchor at a customized URL... like this:
Tweet this!
I can't seem to find anything in the Facebook documentation.
Not exactly an answer, but close enough for me:
http://www.facebook.com/sharer.php?u=http://mysite.com/
That'll do it.
There is a non-depreciated equivalent to the twitter or sharer.php functionality, though it is way more annoying. This doesn't exactly answer the question about "liking" a page but does accomplish the exact analogy to the twitter share, which seems to be what the question is asking.
https://developers.facebook.com/apps/ - make a new app with a developer account.
Make the Display Name the name of your business or website
add your domain without http under App Domains
add your base URL under Website with Facebook Login (with http )
Grab the App ID
Now make your url like this:
http://www.facebook.com/dialog/feed?app_id=000000000000000&link=http://example.com/whatever&redirect_uri=http://example.com/backtothesite
You would think the redirect_uri would default to the user's facebook home or to the link parameter, but it's a required field.
More parameters here: http://developers.facebook.com/docs/reference/dialogs/feed/
No, Facebook only permits Liking a page via a Like button.
At the bottom of this page:
http://developers.facebook.com/docs/share/
Feel free to create your own implementation based on this.
There is a way how to do it, but not very comfortable for users, because they must click on 'like' button twice.
https://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fexample.com%2F
http%3A%2F%2Fexample.com%2F is url encoded version of http://example.com/ .
Or you can place this link into iframe and then only one click is needed for liking of url
It's a little more verbose with Facebook to do the same thing.
<div id="fb-root"></div>
<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={YOUR_APP_ID}";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-like"
data-href="http://mysite.com"
data-send="true"
data-width="450"
data-show-faces="true">
</div>