A small snippet for making facebook and google plus share button

I think everybody sees a share button on websites and wonder that it is complex to implement. But in reality, it is so easy and you don't need to use any official API or libraries for that. All you have to do is embed the URL of your web page into the following HTML snippet. If you are using facebook SDK for authentication then you can explicitly ask for permission for posting in user feed when they logged in. But it is a little more complex method as we need to use facebook SDK and create an app and get permissions from facebook after verifying app etc. So I am skipping that method for another time.

Here is the code for making facebook share button in your website

<a  href="https://www.facebook.com/sharer/sharer.php?u=<?php echo "http://shareurcodes.com"; ?>" target="_blank">
  Share on Facebook

Here is the code for making google plus share button in your website

 <a href="https://plus.google.com/share?url=<?php echo "http://shareurcodes.com/"; ?>" onclick="javascript:window.open(this.href,
  '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;">
    <img src="https://www.gstatic.com/images/icons/gplus-64.png" alt="Share on Google+"/>


Web development
22nd Jul 2018 02:01:15 AM
PHP CodeIgniter Laravel Bootstrap HTML & CSS


ShareurCodes is a code sharing site for programmers to learn, share their knowledge with younger generation.