Facebook call back function with timeout
Posted
by
Dirty Bird Design
on Stack Overflow
See other posts from Stack Overflow
or by Dirty Bird Design
Published on 2012-08-28T03:36:09Z
Indexed on
2012/08/28
3:38 UTC
Read the original article
Hit count: 179
So I've been getting my ass kicked pretty good with Facebook's moving target of an API. I need to display some hidden content after a person clicks 'like' on a landing page. I can somewhat get this to work, when the user clicks 'like' the normal fb dialogue appears and then goes away immediately and content is displayed. I have 'achieved' this with the following js.
<script>
FB.Event.subscribe('edge.create', function(href, widget) {
document.getElementById('goodies').style.display = "block";
document.getElementById('fb-content').style.display= "block";
document.getElementById('copy').style.display = "none";
});
</script>
I cannot find any documentation about a callback event after someone hits "post to facebook" or after the dialogue closes, only afte they hit like. How would I incorporate a setTimeout function into this to give people some time to fill out the fb dialogue?
thanks. If anyone has a better way to do this I'm all ears. This is for a business page and I cannot seem to add an app to get an app ID anymore so the API is pretty useless to me at this point. Also, if the url to be liked is a fb page, the callbacks don't seem to fire.
Other code used:
<html xmlns:fb="http://ogp.me/ns/fb#">
<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'));
</script>
<fb:like href="onlynonfburl.com" send="false" layout="button_count" width="450" show_faces="false" font="arial"></fb:like>
© Stack Overflow or respective owner