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 8478081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:38:47+00:00 2026-06-10T18:38:47+00:00

I have the following feature where the user can share a feed. The below

  • 0

I have the following feature where the user can share a feed. The below code gets block by pop up blockers on most browsers. I’ve seen several post on stack overflow about this issue. One recommended using the onclick which i’ve tried. I’ve noticed that if my facebook sdk fails i don’t get the popup block. What is the best plan of attack. I’m using php.

<a class="facebook" href="#" onclick='loadSdk(); return false;'></a>

<script>

function loadSdk(){

    window.fbAsyncInit = function() {
        FB.init({
            appId      : '123', // App ID
            channelUrl : 'http://mysite.com/facebook', // Channel File
            //   status     : true, // check login status
            cookie     : true, // enable cookies to allow the server to access the session
            xfbml      : true  // parse XFBML

        });

        if (typeof facebookInit == 'function') {
            facebookInit();
        }

        FB.api('/me', function(user) {
            if (user) {
                var image = document.getElementById('image');
                image.src = 'https://graph.facebook.com/' + user.id + '/picture';
                var name = document.getElementById('name');
                name.innerHTML = user.name
            }
        });
    };
    // Load the SDK Asynchronously
    (function(d){
        var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
        if (d.getElementById(id)) {return;}
        js = d.createElement('script'); js.id = id; js.async = true;
        js.src = "//connect.facebook.net/en_US/all.js";
        ref.parentNode.insertBefore(js, ref);

    }(document));
}

 function facebookInit(){

        var publish = {
            method: 'feed',
            message: '',
            name: '',
            caption: '',
            description: (

                ),
            link: 'http://mysite.com/',
            picture: 'http://mysite.com/fblogo.png',
            actions: [
                { name: '123', link: 'http://www.mysite.com/' }
            ],
            user_message_prompt: 'Share your thoughts'
        };

        FB.ui(publish, null);

}

</script>
  • 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-06-10T18:38:48+00:00Added an answer on June 10, 2026 at 6:38 pm

    Currently you are loading the SDK onclick – why?

    You want to execute the function that opens a popup – facebookInit in your case – onclick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code in HomeController ; it gets latest date and shows songs
When I create my feature I have the following choices for feature scope: WEB
I have the following form for photo_album which uses the nested forms feature of
I have the follwing code that provides an auto refresh feature to a WCF
I have following div in a page (I can not modify). <div id=:0.control>Click me</div>
I have the following models: Asset and User Assets belongsTo User User hasMany Assets
I have a feature that gets installed using a WSP package, when the feature
I have the following PHP code which simply grabs a URL behind HTTP-Basic authentication
I am looking for a e-commerce solution which can allow the following feature... For
I have a-facebook-like mentioning feature in my app. When creating posts or comments user

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.