-3

<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&version=v2.9&appId=1326374217440368";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-share-button" data-href="https://s3.ap-south-1.amazonaws.com/viyatrademo/suggestedVideo2.html" data-layout="button" data-size="small" data-mobile-iframe="true"><a class="fb-xfbml-parse-ignore" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fs3.ap-south-1.amazonaws.com%2Fviyatrademo%2FsuggestedVideo2.html&amp;src=sdkpreparse">Share</a></div>

Error output screen:

error output screen

How do I resolve this problem?

krlzlx
  • 5,752
  • 14
  • 47
  • 55
  • what is the question? why can't you use CSS to put it where you want? – vsync Jun 08 '17 at 15:08
  • i want to share the video link to facebook. – Bhartendu Kumar Jun 13 '17 at 06:01
  • i have added the fb share icon over the player but when i click the share icon it gives the error shown in image – Bhartendu Kumar Jun 13 '17 at 06:02
  • check this link https://s3.ap-south-1.amazonaws.com/viyatrademo/tryshare.htm try clicking on fb icon which displays on player on hovering the mouse. – Bhartendu Kumar Jun 13 '17 at 06:39
  • you need to setup the allowed domains on facebook developers panel.. this isn't related to SO but it's your fault you don't read the facebook documentation. The **title** of this question doesn't represent the actual question – vsync Jun 13 '17 at 08:32
  • ya this is what i m trying to do adding the domain and then generating the app id and secret key and finally activating the app id but this is not happening it gives a error domain name is not whitelisted. https://s3.ap-south-1.amazonaws.comthis is the link which i m trying to put in the fbdeveloper – Bhartendu Kumar Jun 13 '17 at 10:01
  • I have my all css and js file in the amazon s3 bucket and from there only i m hosting this code.So which domain name should i enter in the fbdeveloper – Bhartendu Kumar Jun 13 '17 at 10:04
  • why can't you just google it? I found answers in 3 seconds [here](https://stackoverflow.com/q/37255315/104380) and [here](https://www.google.ie/search?q=facebook+share+%22can%27t+load+url%22&ie=utf-8&oe=utf-8&gws_rd=cr&ei=X90_Wb3YHcTQjAOWzbHoCw) – vsync Jun 13 '17 at 12:42

1 Answers1

0

In https://developers.facebook.com

  • Check you created an app (will give you "your app ID")
  • Double check that your domain name is declared in the app
  • Press on "Quick start" that will show you the code you'll have to use.

In your header:

<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : 'your app ID',
      xfbml      : true,
      version    : 'v2.9'
    });
    FB.AppEvents.logPageView();
  };

  (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>

In your file:

<div class="My-fb-Button">
<div class="fb-like" data-href="<?php echo esc_url( get_permalink() ) ?>" data-layout="box_count" data-action="like" data-size="small" data-show-faces="false" data-share="false"></div>
</div>

In your CSS:

.My-fb-Button{ 
    float: right; /* wherever you want to position your button */
    margin-top:10px;  /* wherever you want to position your button */
    margin-right: 10px;  /* wherever you want to position your button */
 } 
Chris
  • 1
  • 1