way - https://developers.facebook.com/docs/reference/javascript/
In the following codes the user is made login to facebook by
FB.login call.After user grants permission, a temporary access
token "token" is retrieved, which is used for Graph api call
FB.api.Before that you have to get the page/profile id and place
as a parameter in the FB.api call below -
FB.login(function(response) {
if (response.status=='connected') {
if (response.authResponse.accessToken)
{
var token = response.authResponse.accessToken;
FB.api('/'+Page/profile_id_here +'/feed?access_token='+token+'&message=test_message', 'POST', function(response){
if (!response || response.error) {
alert('Errors');
} else {
alert('posted successfully');
}
});
} else {
// user is logged in, but did not grant any permissions
alert('Error: You can create an access token only for your own profiles and pages.');
}
} else {
// user is not logged in
alert('Error: To Post you have to generate an access token.');
}
}, {scope:'publish_stream' });
Hope that helps.Don't forget to like and share.