I am using the following code to alert the user when he click the facebook like button. It is alerting the user only on Opera browser. How do I fix this problem and make it work
Where did you put this code ?
For me you have to put this in the init like this :
window.fbAsyncInit = function() {
FB.init({
appId : APP_ID,
status : true,
cookie : true,
xfbml : true
});
FB.Event.subscribe('edge.create',
function(response) {
alert("You liked the URL");
}
);
};
If you have already call the FB.init, you have to use a trick like this :
<script type="text/javascript">
function hasFBLoad(){
if(FB != 'undefined'){
FB.Event.subscribe('edge.create',
function(response) {
alert("You liked the URL");
}
);
}else{
setTimeout('hasFBLoad()', 200);
}
}
hasFBLoad();
</script>