I am not sure whether this is possible

can i have a fan gate between two pages of a website, so that before a visitor can access a particular url it would be mandatory to like our fan page on facebook?


I have a travel website puneritraveller.com, and for each destination featured in the website i have listed hotels, with a direct link to the website of the hotel.

for example i have featured a destination 'Alibaug' with a hotels page - puneritraveller.com/alibaug-hotels.html , in this page i have given banner ads for a few hotels for example Yellow house which on clicking redirects to www.yellowhousealibag.com

What i want to achieve is, when someone clicks on the banner ad for Yellow house they should be redirected to a page with a like button to facebook.com/puneritraveller and once he/she clicks on the like button should be redirected to www.yellowhousealibag.com

Is this possible? Please help


2 Answers 2


This is actually against the Facebook terms which bar webmasters and developers from requiring a like button be clicked for something to be done as it is considered a blackhat technique to artificially boost page likes. It used to be possible by adding an onclick event handler to the button after it was rendered to detect when it was pressed but since then Facebook has made changes to the code to detect when a new onclick event is attached to it and to disable the onclick event from being fired so this is no longer even possible. Facebook also does do random checks and audits and when it sees something like this happening has been known to reduce the likes to a page to a more reasonable level to take into account removal of what the perceived number of false likes was


You can do this using FB.Event.subscribe:

var page_like_callback = function(url, html_element) {
  window.location.href = "http://www.example.com";

// In your onload handler
FB.Event.subscribe('edge.create', page_like_callback);

Simply setting up a like wall might get you penalized by Facebook. What you could do is create a page or modal that asks:

Before we continue, I want to ask do you like our website?

  • Yes I [👍 Like] it
  • [No, not really]

skip this, just take me to the download

When a user presses 'no', show a feedback form. It can give you valuable information about how to improve.

I'd add a 'skip this' link to be on the safe side.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.