I have using facebook plugins in a .net website. Recently they have stopped showing the stream and faces (header displays correctly).
The biggest indicator is if I use the developer toolbox the stream and faces show - the exact same code in my web page and they don't show. They used to display - I'm not sure at what point they have since broken so I can't track my code changes.
My code:
(Placed below the body tag)
<script type="text/javascript">
(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/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));
</script>
(Placed further down the page)
Related
I've added most of the leverage browser cache after reading many updates but this one keeps popping up.
Leverage browser caching for the following cacheable resources:
http://connect.facebook.net/en_GB/sdk.js (20 minutes)
Now i've found the path in the file which does it where can i manually add a bit of code to it and which code do I need to use?
<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/<?php echo get_locale(); ?>/sdk.js#xfbml=1&version=v2.3&appId=123456789";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
Nevermind - I found out there is nothing I can do as it's controlled by facebook their end. Unless I remove the facebook widget I have to put up with it.
My website is using both Codeigniter and JqueryMobile. I am trying to insert a facebook share button in my website.
The button only show at the first time. However, It will be disappeared if you go to other page and back to the original one.
I discover that the below code run well under either Codeigniter or JqueryMobile. But the problem occurs if both framework are used at the same time.
<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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/" data-layout="button"></div>
I've set up a Facebook Like button on my site. It seems to work fine. If I like something it appears on my Timeline and all the links work.
However, if I'm logged out of Facebook and you get the message 'Sign up to see what your friends like'. Clicking sign up takes you to Facebook and tries redirecting to r.php.
The Javascript code I have in my footer is exactly what Facebook suggests:
<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=487139091399600";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
Sample page is
http://www.visitkievukraine.com/accommodation/premier-palace/
Run through the debugger fine.
I am trying to get the Activity Feed Social Plugin to display on this website: http://wrdtempsite.com.au/qualdes/
(It's WordPress run and has the WordPress SEO plugin installed which has FB meta data)
Nothing shows at all, but I get no errors. (It should display on the right hand side of the homepage).
Code below:
<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/all.js#xfbml=1&appId=XXXXX";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-activity" data-site="http://wrdtempsite.com.au/qualdes/" data-app-id="XXXXX" data-width="300" data-height="600" data-header="true" data-recommendations="false"></div>
I cannot see what is wrong? Any help would be much appreciated.
Thanks
It was a css rule that was basically 'hiding' the widget from view.
.fb_iframe_widget iframe {position:absolute;}
I changed that to position relative.
The documentation for the Facebook like button suggests including the following script:
<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/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
As I read it, this does nothing more than add the external all.js file before the first script tag on the page.
<script id="facebook-jssdk" src="//connect.facebook.net/nl_NL/all.js#xfbml=1"></script>
Is there any reason to not just add the completed script tag to the page source in the first place?
From the Javascript SDK page;
This code loads the SDK asynchronously so it does not block loading other elements of your page.
In other words, yes, you could most likely include it right away, but the user would experience it as if your page were loading more slowly.
What is the difference between this:
<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/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
and this:
<script src="//connect.facebook.net/nl_NL/all.js#xfbml=1" async></script>
?