Add Facebook share button in website

Add share facebook button in the website

Having social connectivity for your business or website is must thing nowadays. Sometimes it is hard for a non technical person to find a easy way to add such functionality to the website without any or less coding required.

 

You can add Facebook share and like button on your website so user could share about your website on their timeline with just a click. 

 

It is really important because more your website or business is shared on social media, you will more likely to get good traffic and customers.

 

By using following methods, you can insert Facebook share button on your website. I will go with the easiest first.

 

Add share button using <a> anchor tag

				
					<a href="https://www.facebook.com/sharer/sharer.php?u=example.org" target="_blank"> Share on Facebook
</a>
				
			

You need to update “example.org” with your website URL that you want to share. You can update the text between <a> tag to anything and stylize your button based on your website.

 

For Facebook share with an image without an API and using a # to deep link into a sub page, the trick was to share the image as picture= The variable mainUrl would be http://yoururl.com/

				
					var d1 = $('.targ .t1').text();

var d2 = $('.targ .t2').text();

var d3 = $('.targ .t3').text();

var d4 = $('.targ .t4').text();

var descript_ = d1 + ' ' + d2 + ' ' + d3 + ' ' + d4;

var descript = encodeURIComponent(descript_);

var imgUrl_ = 'path/to/mypic_'+id+'.jpg';

var imgUrl = mainUrl + encodeURIComponent(imgUrl_);

var shareLink = mainUrl + encodeURIComponent('mypage.html#' + id);

var fbShareLink = shareLink + '&picture=' + imgUrl + '&description=' + descript;

var twShareLink = 'text=' + descript + '&url='+ shareLink;

// facebook

$(".my-btn .facebook").off("tap click").on("tap click",function(){

var fbpopup = window.open("https://www.facebook.com/sharer/sharer.php?u=" + fbShareLink, "pop", "width=600, height=400, scrollbars=no");return false;

});

// twitter

$(".my-btn .twitter").off("tap click").on("tap click",function(){

var twpopup = window.open("http://twitter.com/intent/tweet?" + twShareLink , "pop", "width=600, height=400, scrollbars=no");


				
			

Found this post helpful? Let us know your suggestions and queries. We’ll try to help as soon as possible.

 

More tips and updates here.

 

FOLLOW US ON:-

 

Leave a Reply

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

Picture of Sahibjot Singh

Sahibjot Singh

Hey there! I'm Sahibjot Singh, and I've been on an exciting journey as a Web Designer/Developer and Email Automation expert for the past 12 years. It's been a fantastic ride filled with new challenges, and I've learned how to overcome various issues along the way.

One thing that's always been a part of my journey is the need to research and gather different puzzle pieces, using my coding knowledge to piece together solutions for a wide range of problems.

But here's the thing: I've realized that there are many business entrepreneurs and non-technical folks out there who don't have coding skills but often find themselves in similar situations.

So, what makes Unbouncehacks/Unbouncetips special? Well, it's not just a collection of scattered information. I've put together complete end-to-end solutions for the very problems I've encountered and that you might face in the future.

Plus, I keep this website updated with fresh tips and suggestions that have helped me excel in design and email marketing over the years. So, you're in for a treat with a treasure trove of knowledge! 🚀

Share:

Facebook
LinkedIn
Twitter
Skype
WhatsApp

Most Popular

Follow Us

Categories

Doing the best for email marketing? Still your domain can be black listed if you hit a spam trap, once.


Verify your contacts for FREE and make sure there are no spam traps or invalid emails. 

Read More

Related Posts

― Receive the latest articles
Subscribe To Our Newsletter

Get notified about new articles