Hi All,

I am trying to share articles to Facebook using Facebook share button. While i am trying to share the discription displays as "Hi You don't have an account please register an account by entering..." like message. It will happen only using to share the "http://www.crazyenews.com/" and related sub pages. But it works fine for "http://www.olx.com", "http://www.google.com", "http://www.sulekha.com" urls. Find the snap in attachement and

The code am using as follows

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=737830762939031&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-share-button" data-href="http://www.crazyenews.com" data-layout="button_count"></div>

Please provide the solution.

Thanks in advance

Thanks,
Mahesh

did you include the Javascript SDK right after the <body> tags?

for example,

<body>

    <script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : 'Put__Your_Own_App_ID__Here',
      xfbml      : true,
      version    : 'v2.1'
    });
  };

  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));
</script>

The APP ID you need to sign-up for it on facebook website.

I am tried through the facebook developer site itself there also same thing please find the attached screen shots. Whats the issue its only not working in my site url only..

Do you have a facebook developers account?

if so, have you created an application?

is the application set to public or development?

Here is a test app I just created 3 minutes ago and I followed the same instructions I have given you.

1612a2e13fcbfe8f6fd40840e6f3bce9

did you add the button like this?

<div class="fb-share-button" data-href="http://YourDOmainDotCom/whatever_page" data-layout="icon_link"></div>

try rewriting your javascript like this

from this

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1">
    <div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=224643507660473";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

to this

<script src="http://connect.facebook.net/en_US/all.js#xfbml=true">

(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=224643507660473";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

</script>

<div id="fb-root"></div>

I personally tested the script above using my own app ID and it work the same as my first recommended implementation above.

If still doesn't work out for you, you will have to post your isssues on facebook developer support.

Thanks for the reply. Did you checked with specified URL is it works?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.