Main menu
WalkswithMeSocial NetworkingFacebook share button with custom parameters

30 thoughts on “Facebook share button with custom parameters

  1. Hello, I like the look and easy set up + use of your plugin 🙂
    I have 2 questions :
    1) Is it possible it is not working with the media grid content? (as opposed to a caroussel content)
    2) I noticed that when sharing on Facebook, we can only share on our personal timeline but not on a page we manage or on a group page… is there a special setting to do that?
    Thank you very much !
    France

  2. Hi,
    Using the same feed box and FB.ui, Can I share video along with the redirect link of my website?
    Tried a lot but able to post only video on Facebook, When click on description, it redirects me to Youtube page.
    Please find below snippet :
    FB.ui(
    {
    method: ‘feed’,
    name: ‘my name,
    caption: ‘my caption’,
    picture: ‘thumbnail pic’,
    link: ‘http://www.youtube.com/watch?v=3aICB2mUu2k’, # video link
    source: ‘http://www.youtube.com/v/3aICB2mUu2k?autoplay=1’, #video source
    description: ‘my description’,
    title: ‘my title’,
    },
    function(response) {
    if (response && response.post_id) {

    }}

    Thanks

    1. It should work,

      FB.ui(
      {
      method: 'feed',
      name: 'testing',
      link: 'http://www.facebook.com',
      picture: 'http://img.youtube.com/vi/1CE6W5BubQo/0.jpg',
      //caption: '',
      description: '',
      source: 'https://www.youtube.com/v/1CE6W5BubQo?version=3&autohide=1&autoplay=1'
      },...

      for more information check this link

      1. Hi,
        I used above given link, It is not working for me i.e I have to pass youtube video link in both ‘LINK’ and ‘SOURCE’ parameters. Is there any other solution?

          1. Thanks!
            Done with this task. Fb documents are not efficient enough for video sharing. One has to pass ‘Link’ and ‘Source’ both. For example:

            link : ‘https://www.youtube.com/watch?v=nCD2hj6zJEc’,
            source: “https://www.youtube.com/v/nCD2hj6zJEc?autoplay=1”,

            in fb.ui params.
            Only difference is “WATCH?V” in link and “/V/” in source. If we pass like this, only then it works fine.

  3. when i use the same with my app id,,i am getting this ” An error occurred. Please try again later.”
    please help to resolve

    1. This happen due to few reason , When you check my previous comment you will get answer.
      The major reason is domain with and without www . means you may create app with www. and site is running without www. or in reverse.
      Check the comments it will be able to fix.

  4. Hi,
    I tried this code but it is not working. When I checked the console and placing alert inside fb.ui alert is not getting shown.please help.

    1. Do not write code inside FB.ui({}) its facebook ui function call,
      So if you need to make a custom message or alert you can write inside
      after this line,

      var share_capt = 'caption';
      alert("here");

      or after successfully share call back function

      if(response && response.post_id){
      alert("Success")}
      else{
      alert("Failed ")}

      try this and let me know

  5. Thankx for this code but how to close the popup after sharing ??? mean where to put redirect uri ???

      1. Thank u for such a timely reply but in my case pop up is not closing even after success full share 🙁

        1. Which browser are you testing ?
          Normally it will automatically close on all modern browsers. if it doesn’t do it , try to close manually.

          just add the script, in the response of AJAX

          if(response && response.post_id){
          window.close();
          }

  6. Hello! This code works only on Chrome. I have tried it on Mozilla and Safari and it says that an error occurred. Am I doing something wrong?

  7. Hi,

    I’ve replied your code, but it does no work. Maybe I’m doing something wrong:

    This is the code in my page where I suppose to call your function:
    echo ”;

    Any idea?

    1. For make it working , create a custom share button means you have to create a simple button with image or your custom css styles.

      Then register an app with FB the on click of that button trigger the FBShareOp() function inside the function just get the required values like images, text etc.
      It will do the rest, If you need call back (after sharing event ) that also available.

      1. Hi,

        I have been following your instruction but now i am a little stuck, I think i am up to the pat of creating the custom button but i want to use a button i have created from fontawesome, not quite sure how i integrate the code of FB to my code.

        This is the bare bones. Any help would be very much appreciated.

        Regards

        Patrick

        1. Suppose the custom button is an “a” tag then onclick=”FBShareOp();”
          inside this function you can see assigning images,urls etc.

          <a href=”#” onclick=”FBShareOp();” > FB Share </a >

          if you are using jQuery try something like below inside the function.
          make sure you pass the custom values properly here title,descriptions are example you have to set the correct values.
          function FBShareOp(){
          var product_name = jQuery(“#title”).val();
          var description = jQuery(“#description”).html();
          var share_image = jQuery(“#share_image”).attr(‘src’);
          var share_url = jQuery(“#share_url”).attr(‘href’);
          var share_capt = jQuery(“#share_capt”).val();
          FB.ui({
          method: ‘feed’,
          name: product_name,
          link: share_url,
          picture: share_image,
          caption: share_capt,
          description: description

          }, function(response) {
          if(response && response.post_id){}
          else{}
          });

          }

Leave a Reply

Your email address will not be published. Required fields are marked *

 

FacebookTwitterGoogle+RSS