Tag Archive for 'facebook connect'

Facebook: Sending App to user notifications through Javascript

If you refer to facebook’s documentation at http://developers.facebook.com/docs/?u=facebook.jslib.FB.ApiClient.notifications_send, you will notice that there are no parameters to specify an app_to_user notification type. To achieve this, you have to use the callMethod from the apiClient.

Here is a code snippet on how this can be achieved in a Facebook Connect site.

<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
 <script type="text/javascript">
	FB_RequireFeatures(["XFBML"], function(){ 
		FB.Facebook.init("API KEY", "relative_path_to/xd_receiver.htm"); 
		FB.Facebook.apiClient.callMethod("notifications_send",{to_ids:[000000000],notification:"hello",type:"app_to_user"},function(){alert("notification sent");});	
	});
</script>

This code sends a notification from the app to the specified user ids. When the notification is done, a javascript alert box tells us the task is completed.

Facebook Connect in 3rd party iFrame with IE7 and below

If you are having problems trying to get Facebook to set cookies properly in IE7 and below when the site is sitting in an iframe and have a different domain with its parent container, check out this article to create a privacy policy for IE7.

http://www.softwareprojects.com/resources/programming/t-how-to-get-internet-explorer-to-use-cookies-inside-1612.html

and this fb forum thread:
http://forum.developers.facebook.com/viewtopic.php?id=452

Just tried it and FB Connect now works with 3rd party iFrame containers :)