Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6918435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:51:31+00:00 2026-05-27T09:51:31+00:00

I have created application in Facebook. By using Facebook Javascript SDk, I posted message

  • 0

I have created application in Facebook. By using Facebook Javascript SDk, I posted message from android phonegap application to facebook wall.But I want to display permission dialog before message post on the wall
(ie) While I am clicking “Allow” button in the permission dialog message should post on the wall,while i am clicking “Don’t Allow” button, message should not post on the wall.
My code is:

<body>
<div id='fb-root'></div>
<script src='all.js'></script>
<input type="text" value="User ID" name="user_ids" />
           <p><a onclick='postToFeed(); return false;'>Post to Feed</a></p>
            <p id='msg'></p>
    <script> 
      FB.init({appId: "xxxxxxxx", status: true, cookie: true});

      function postToFeed() 
    {
                    var user_ids = document.getElementsByName("user_ids")[0].value;
                   alert(user_ids);

                    FB.api('/me/feed', 'post', { message: user_ids}, function(response) {
                           if (!response || response.error) {
                            alert('Error occured');
                           } else {
                           alert('Post ID: ' + response.id);
                           }
                   });
      }
   </script>
  </body>

the above code is hosted on server. In phonegap(index.html) i called the url using window.open method, It will display textbox and button. while i am clicking the button,(get value from textbox)the message should post on the wall
how to set permission dialog for this coding or how to pass {perms:’publish_stream’} in FB.api(‘/me/feed’)

Please give me some suggestion /ideas

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:51:32+00:00Added an answer on May 27, 2026 at 9:51 am

    I don’t know if I’m getting your question right, but I would suggest this:
    First ask permission and in the next step show the send button or send a post automatically – what ever you want. Not both at the same time (I just don’t get the concept). Here is some code that might help you a little:

    window.fbAsyncInit = function() {
        FB._https = true;
        FB.init({
            appId : 'APP_ID',
            status : true, 
            cookie : true, 
            oauth : true 
        });
    
        // Check whether the user is connected to the app
        FB.getLoginStatus(function(response) {
            if (response.status !== 'connected') {
                // The user has not authorized the app
                authorizeApp();
            } else {
                // The user has already authorized the app
                var fbuid = response.authResponse.userID;
                var accessToken = response.authResponse.accessToken;
                FB.api('/me', function(response) {
                    // Check for publish_stream extended permission
                    var query = FB.Data.query('select publish_stream from permissions where uid={0}', fbuid);
                    query.wait(function(rows) {
                        if(rows[0].publish_stream == 1) {
                            // The user has granted the extended permission
                            postToWall();
                        } else {
                            // The user has not granted the extended permission
                            authorizeApp();
                        }
                    });
                });
            }
        });
    };
    (function() {
        var e = document.createElement('script');
        e.type = 'text/javascript';
        e.src = document.location.protocol + '//connect.facebook.net/de_DE/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
    }());
    
    function authorizeApp() {
        // Redirect the user back after authorization
        var path = 'https://www.facebook.com/dialog/oauth?';
        var queryParams = ['client_id=APP_ID', 'redirect_uri=REDIRECT_URI', 'response_type=token', 'scope=publish_stream'];
        var query = queryParams.join('&');
        var url = path + query;
        top.location.href = url;
    }
    
    // OR
    function authorizeAppInPopup() {
        FB.login(function(response) {
            if (response.authResponse) {
                // User authorized app
                postToWall();
            } else {
                // User cancelled login or did not fully authorize
            }
        }, {scope: 'publish_stream'});
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have downloaded php-sdk for using facebook in php. I also created facebook application
I have created an application using Adobe Flex. I took all the files from
I have created a facebook application using FaceBook ToolKit for .Net, What I am
I have created a java web application using spring. I want the users of
I have an issue with SSO using the Facebook SDK for Android. The problem
I created an asp.net mvc 3 facebook application using facebook c# sdk. I'm trying
I have implemented single sign on functionality using Facebook's SDK in my iPhone application,
I have used facebook application for one of my android application. But i need
I have created fan page.I am using iframe application.I want to add comment on
I have a facebook canvas application and I want to upload a file from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.