Step1: Step 2: Step3: Step4: <div id="fb_div"> <h3>Post to your Facebook wall:</h3> <br /> <textarea id="fb_message" name="fb_message" cols="70" rows="7"></textarea> <br /> <input type="button" value="Post on Wall" onClick="post_on_wall();" /> </div> window.fbAsyncInit = function() { FB.init({ appId : 'xxxxxxxxxxxxxxx', status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true , // parse XFBML oauth : true // Enable oauth authentication }); }; function post_on_wall() { FB.login(function(response) { if (response.authResponse) { alert('Logged in!'); // Post message to your wall var opts = { message : document.getElementById('fb_message').value, name : 'Post Title', link : 'www.postlink.com', description : 'post description', picture : 'http://2.gravatar.com/avatar/8a13ef9d2ad87de23c6962b216f8e9f4?s=128&d=mm&r=G' }; FB.api('/me/feed', 'post', opts, function(response) { if (!response || response.error) { alert('Posting error occured'); } else { alert('Success - Post ID: ' + response.id); } }); } else { alert('Not logged in'); } }, { scope : 'publish_stream' }); }
create a div with id=”fb-root” and paste below code after this div <div id="fb-root"></div> (function() { var e = document.createElement('script'); // replacing with an older version until FB fixes the cancel-login bug e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; //e.src = 'scripts/all.js'; e.async = true; document.getElementById('fb-root').appendChild(e); }());
Post to your Facebook wall using Javascript SDK
Step1: [code language=”html”] <div id="fb_div"> <h3>Post to your Facebook wall:</h3> <br /> <textarea i
Work with Scriptbaker
Let's talk about your project
Whether you're extending an existing platform, modernising legacy code, or planning something new, our engineers can help. Tell us what you're working on and we'll explore a practical technical solution together.
Related posts
JavaScript
jQuery Multi File Upload
Discover how jQuery File Upload simplifies file handling with multiple file selection, drag-and-drop support, upload progress bars, image previews, chunked uploads, and resumable transfers. This guide explores its key features, backend compatibility, common use cases, implementation considerations, and security best practices for modern web applications.
JavaScript
Toggle checkboxes with jQuery and Prototype JS
Learn how to toggle multiple checkboxes with jQuery, modern JavaScript, and Prototype.js. This updated guide covers Check All, Uncheck All, dynamic checkboxes, disabled fields, accessibility, common mistakes, and practical examples for building user-friendly forms and admin interfaces.
JavaScript
How to Add a jQuery Tooltip to Your Web Page
Learn how to add a jQuery tooltip to your web page using Tipsy. This guide explains how tooltips work, why they improve usability, how to implement and customize them, common use cases, and best practices for creating helpful and accessible web interfaces.