Tweet or Facebook like to unlock the content using jQuery

In my previous post I had explained How to Create Share Social To Unlock Download Link using javascript. After I get a lot of contact on the part tutorial on Facebook and Tweet to unlock content. Today, I will explain how to request visitors to like or tweet before appear the content or download link using jQuery, Facebook API & Twitter API.


Today, social networks are becoming increasingly popular, so the most effective method for people to know our website is sharing link of our website to social networks to bring new visitors to out website. There are two largest social networks are Facebook and Twitter.

To do Tweet or Facebook like to unlock the content you need:

– The first you need to create an Facebook App, register your website & get an App ID.
– The second, you need to create a Twitter account to using Twitter API.

 Step 1:

Include the following facebook script and Twitter script in your page header, before the body tag.

Step 2:

Include jQuery and Plugin:

 Step 3:

jQuery to initialize social locker:

 Step 4:

Place the below javascript function anywhere in the web page. I have used function SocialLocker events that trigger after user twitted on twitter or like on facebook, it will request visitors to tweet or like before appear the content. If not, The content is hidden.

Script codes above using the TotalStorage function to Storage $.cookie on the browser if visitor tweet or like to show content.

To set Unlock content i set:

To check if visitor already twitted or liked the content i use this script code following

Use CSS to beautify the display on your website:

For the better you can customize CSS with your site.

I hope helps you build your system tweet or like to unlock the content.

Add Your Comment