I want to sync FB posts to my own website, which is Drupal site.
I found this embed code that allow me to embed posts to any website.
<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/zh_CN/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-post" data-href="https://www.facebook.com/Abner.Ma.1989/posts/411557558943779" data-width="466">
<div class="fb-xfbml-parse-ignore">由
马昕睿贴出
贴子。</div>
</div>
You can see if I change the code posts part
data-href="https://www.facebook.com/Abner.Ma.1989/posts/411557558943779"
to something else, then the embed content will change too.
So I think this might be one way to sync posts from FB to my own website.
So the question is : How could I obtain recent FB post ID?
Or: Any way to sync FB posts to my own website?
Thanks!
Related
The greeting_dialog_display is not working. Or have I misunderstood something..? I've set greeting_dialog_display="hide", but the popup still shows up.
[See live example of issue on codepen][1]
[fork and edit pen][2]
Code example:
<!-- Load Facebook SDK for JavaScript -->
<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 = 'https://connect.facebook.net/fi_FI/sdk/xfbml.customerchat.js#xfbml=1&version=v2.12&autoLogAppEvents=1';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<!-- Your customer chat code -->
<div class="fb-customerchat"
attribution=setup_tool
page_id="1160695934081727"
greeting_dialog_display="hide">
</div>
False alarm. The plugin just caches what ever position it's in. So to test you'll need e.g. Chrome incognito with always closing all incognito windows in between.
I have Facebook comments box api on my webpage. So, I want to callback an alert function that when visitor comment on my webpage using Facebook comments book api visitor get the message or at-least the use will redirect to new page after comment. Is it possible? Because I never used this api before so I want help. Kindly let me know your solutions.
Regards
Code by Facebook:
(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.5&appId=559989757482877";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
HTML by Facebook:
<div class="fb-comments" data-href="http://developers.facebook.com/docs/plugins/comments/" data-width="100%" data-numposts="6"></div>
I am Trying:
FB.Event.subscribe('comment.create', function(response) {
alert("Thank You.. Redirecting you now...");
// window.location = "http://google.com";
});
I'm working on an Ember.js application that displays content from a Wordpress backend. In addition to text, this content can contain arbitrary javascript that is typical in the embed code of various social media sites (Facebook, Instagram, Twitter). Unfortunately, this javascript doesn't seem to get executed when the page loads which causes the page to not render the correct content.
Here is what I'm using in my template to render the post content:
{{{model.content}}}
And this is some example content that is not being rendered correctly:
<div id="fb-root"></div>
<script>// <![CDATA[
(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>
<div class="fb-post" data-href="https://www.facebook.com/185429188166097/photos/a.185450081497341.36203.185429188166097/852153634826979/?type=1" data-width="600">
<div class="fb-xfbml-parse-ignore">Post by Sonnie Trotter.</div>
</div>
Is something like this possible?
Please view this sample facebook share 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/sdk.js#xfbml=1&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
The code acts in clinet area (It runs on user's browser).
In some countries facebook is filtered and you can not access it without an unti-filter...
Is there a way to call //connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0 via server? not via user? I hope you underestand me. I want my server act as unti-filter...and user get data from my server as a bridge to facebook!
No. Even if it was that script will do other request to Facebooks servers to get information. If Facebook is blocked it will not work
I used the following script in my web page
In body tag i used 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/sdk.js#xfbml=1&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
In my blog listing I used the following in each blog:
<div class="fb-share-button" data-href="http://test.com" data-layout="button"></div>
Its displayed fine. After 10 blogs while scroll the remaining data are loaded dynamically by using the ajax file.
Here also I used the above script and Div share button. But it is not displayed with the ajax loaded file.
I googled a lot and I couldn't find a right solution. Please help me to fix this.
after ajax, call function FB.XFBML.parse(); to force the refresh/rendering FB share buttons