After logged in to Facebook, we can post message to the logged in user account with hyperlink. Try the following code. Continue reading Facebook Javascript SDK – Post to Wall
Tag Archives: Javascript
Facebook Javascript SDK – Redirect to request for permissions page if the user is not logged in or not subscribed
We can find out the Request for permissions URL of a Facebook application as we discussed previously.
Facebook API – Request for permissions URL
So you can force the user to grant the permissions for your Facebook application by checking their login status and redirecting to the above URL if they are unknown user. Continue reading Facebook Javascript SDK – Redirect to request for permissions page if the user is not logged in or not subscribed
Javascript – Countdown Clock
I found a useful Javascript countdown clock written by Robert Hashemian and modified by Munsifali Rashid. Download the countdown.js @ JavaScript Countdown/Count-up Timer/Clock/Ticker for Web Pages and try the following example.
Continue reading Javascript – Countdown Clock
Facebook Javascript SDK – Logout
Update 2012-01-14: For OAuth 2.0 implementation, please refer to the new post.
Facebook Javascript SDK – Logout with OAuth 2.0
Update 2011-12-19: Since Facebook has updated their authentication system and HTTP to OAuth 2.0 and HTTPS. The following example will not work any more. i will update the post later. For more information, you can refer to Jerry Cain – Updated JavaScript SDK and OAuth 2.0 Roadmap
Add the following Javascript function for Facebook logout.
function logoutFacebook() {
FB.init({
appId:'<?php print YOUR_APP_ID; ?>', cookie:true,
status:true, xfbml:true
});
FB.logout(function() {
// Reload the same page after logout
window.location.reload();
// Or uncomment the following line to redirect
//window.location = "https://ykyuen.wordpress.com";
});
}
Javascript – Generate Random Number
Create the following HTML and you could figure out how to generate random number by Javascript. Continue reading Javascript – Generate Random Number
Facebook Javascript SDK – Reload/Redirect URL after Facebook Login
Update 2012-01-14: For OAuth 2.0 implementation, please refer to the new post.
Facebook Javascript SDK – Logout with OAuth 2.0
Update 2011-12-19: Since Facebook has updated their authentication system and HTTP to OAuth 2.0 and HTTPS. The following example will not work any more. i will update the post later. For more information, you can refer to Jerry Cain – Updated JavaScript SDK and OAuth 2.0 Roadmap
We tried a simple Facebook login using Facebook Javascript SDK yesterday.
Facebook Javascript SDK – A Simple Login Page
In the above post, the browser will not refresh the website URL after the Facebook login process is completed. We have to issue a refresh manually. Actually we can add the reload/redirect with just a simple API call.
Let’s add the FB.Event.subscribe in fb-login.php. Continue reading Facebook Javascript SDK – Reload/Redirect URL after Facebook Login
Facebook Javascript SDK – A Simple Login Page
Update 2012-01-13: For OAuth 2.0 implementation, please refer to the new post.
Facebook Javascript SDK – A Simple Login Page with OAuth 2.0
Update 2011-12-19: Since Facebook has updated their authentication system and HTTP to OAuth 2.0 and HTTPS. The following example will not work any more. i will update the post later. For more information, you can refer to Jerry Cain – Updated JavaScript SDK and OAuth 2.0 Roadmap
Facebook API allows your website to interact with the Facebook content. A very common usage is to authenticate a Facebook user to your website. Let’s try it now.
1. Create the a Facebook App @ Facebook Developers.
2. Enter the website URL under Select how your app integrates with Facebook.
3. Upload the following file to your web server. This file should be located at the URL which we enter in step 2.
fb-login.php Continue reading Facebook Javascript SDK – A Simple Login Page
Javascript – Get Current Date and Time
The following Javascript example shows you how to manipulate the Date object. Continue reading Javascript – Get Current Date and Time
CSS – Set Image/img Opacity with Mouseover Effect
Use the following code to set image opacity.
.imgClass {
opacity: 0.5;
filter: alpha(opacity=50);
}
Continue reading CSS – Set Image/img Opacity with Mouseover Effect
Javascript – Left/Right Pad a String
The following functions help you to pad a string in Javascript. Continue reading Javascript – Left/Right Pad a String