Does fb-like disappear for a while with the fb-share plugin?

Here I work with asp.net web application, I use 2 facebook plugins on my web page.

  • Facebook like
  • Share on Facebook

To share facebook:

<a name="fb_share" type="button" share_url="*******"></a> <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"> </script> 

For facebook like:

  <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"; fjs.parentNode.insertBefore(js, fjs); } (document, 'script', 'facebook-jssdk')); </script> <div id="fb-root"></div> <div class="fb-like" data-href="********" data-send="false" data-layout="button_count" data-width="10" data-show-faces="false" style="width:45px; height:20px;"></div> 

Case 1. The above code works fine when I use one code.

Case 2: when I use facebook as a plugin for some time, it disappeared from the page.

Thanks in advance...

+6
source share
2 answers

As a button and a Share button, you can use it on one page only if you avoid using the provided javascript and use the direct link to share.php (which I will not give for the reasons given below).

If you use http://static.ak.fbcdn.net/connect.php/js/FB.Share , it will break the "Share" or "How" buttons, in accordance with the order in which javascript is turned on, it will work first, the second - in trouble.

A few points to consider:

  • Share button is out of date , please do not use it!

    The Share button has been deprecated in favor of the Like button and will no longer be supported.

  • The Share button can be easily replaced using the Channel dialog box and JS-SDK , which provide more control over the sharing functions:
    FB.ui({method: 'feed', link: document.location.href});
0
source

Please try the XFBML version of a similar button:

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#"> <head> <title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="language" content="de"> <meta name="robots" content="index, follow"> </head> <body> <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=225116190942635"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <a name="fb_share" type="button" share_url="http://www.google.com"></a> <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"> </script> <!--<div class="fb-like" data-href="http://www.google.com" data-send="false" data-width="450" data-show-faces="false"></div>--> <fb:like href="http://www.google.com" send="false" width="450" show_faces="false"></fb:like> </body> </html> 
0
source

Source: https://habr.com/ru/post/918556/


All Articles