Facebook Secret Hide Content on Fan Page Until Someone Likes It
![]() |
Hiding content on your Facebook welcome page can be a great incentive for people to like your page to get the hidden content. Since Facebook depreciated FBML we now have to use iFrames. This is pushing it further into the realms of developers rather than end users.
SEE LIVE EXAMPLE
How To Do It?
An iFrame only points to an html or other web-based file, it doesn’t actually do anything else. Hence the file you are pointing to is not contained on Facebook and can not directly access certain information. This means we must use either JavaScript or a server-based language such as PHP or .NET to communicate with Facebook as would an external page.
Since JavaScript and other methods require actual permissions from the user to see this information the only way I have found to do it, is to look in the “session” so to speak.
Step 1 – Create A PHP file and create the iFrame
If you don’t have an iFrame and php file already look at: How To Add An iFrame Application Tab To Your Facebook Page. This will take you through adding an iFrame application tab to your Facebook page.
However replace the .html file with a .php file. Only the extension of the file name needs to change and not anything else within the example.
Step 2 – Insert Code into PHP file
Next you need to add this in the part of your PHP file you want to display a different message for non fans and fans.
$request = $_REQUEST["signed_request"];
list($encoded_sig, $load) = explode('.', $request, 2);
$fbData = json_decode(base64_decode(strtr($load, '-_', '+/')), true);
if (!empty($fbData["page"]["liked"]))
{ ?>
You are a fan – insert html here
You are not a fan – insert html here
Step 2 – Testing
To properly test your code:
- Go to your Fan Page and click the Unlike Button in the bottom left hand side of your page.
- You should now see the “Like” button at the top, meaning that you’re not yet a fan
- You should see the content of Non-Fan
- Click the “Like” button; you should then see the fans-only content and the non-fan content will go away
That’s It!
Facebook Secret Hide Content on Fan Page Until Someone Likes It,
|
![]() |






































cool stuff dude, thumbs up!
Thanks man!!!
Tried the tweak above and it still shows up the content.
If first shows the “I’m not a fan” text and then goes ahead and loads the content regardless.
Any help ?
Thanks
Pete
Hello Peter
Email me your code to jgucci@dynastywebsolutions.com and I will check it out for you.
A Legend, was my server after all. Worked a treat. Thanks again for this wicked little work around. Highly recommend this to all you bookers out there..:0)
Many thanks
Pete
My pleasure Pete.
Glad you worked it out!
I was lost without your help to be fair! much appreciated
I can’t get this to work. Keeps showing me “you’re not a fan” content.
What is the url of your PHP file?
Hi
I try it but it dosen’t work ad i really need help :(
I’ve created the application and all works but when i put the code in the page give me an error.
Where i have to put the code? in the body?
THIS IS MY CODE
————————————————–
xxxxxxxxx
body {
width:520px;
margin:0; padding:0; border:0;
overflow:hidden;
}
You are a fan – insert html here
You are not a fan – insert html here
——————————————————————————————————
thanks for help!
Email me the file you are using to jgucci@dynastywebsolutions.com
I will take a look.
i’ve just send you an email
thank u so much!
Hi,
Thank you so much for this work around.
I’m going to try to do this myself but I need a server/hosting plan first, right?
If I get a hosting plan from godaddy just for the landing page so no one can see the Wall content without “liking” the page first how big or small a plan would you recommend?
Hope I can pull this off. :)
Thank you!
you always have great tips for us and I really appreciate it.
Hiding content before getting a Like seems such a good idea to get more Like for your page and increase the speed of how fast you can go viral.
I’ll have to see if I can do this.
Best,
Changis
This does not work for me. I copied and pasted the code as-is on the server and saved it as index.php
My canvas URL is: http://mydomain.com/facebookpromo/
My tab URL is: http://mydomain.com/facebookpromo/index.php
When visiting the tab URL above, I get a 500 server error. However when appending something to the URL such as: http://mydomain.com/facebookpromo/index.php?signed_request=1.1 something looks to be working. I feel like a large chunk of instructions is missing, what am I doing wrong?
Does your host run PHP?
Yes it hosts PHP, we have a wordpress blog running. As mentioned, the script only seems to work when appending ?signed_request=x.x to the URL where it reveals the non-fan content message. Why is this?
When creating the facebook iframe app, I’m linking to the .php file directly which prompts the 500 error.
You are pretty much a star .
Thank youfor helping me with this
Thank You!!!
how if html??
i have no server side technology can be used
any help would be appriciated
littleshell@live.hk
This will not work with HTML. You need to wrap php tags around it.
Here is the code I have. I am using it on this page: As you can see the page is blank. What’s the problem?
http://www.facebook.com/pages/Like-test/223160804404088?sk=app_204050586329040
< ?php
$request = $_REQUEST["signed_request"];
list($encoded_sig, $load) = explode('.', $request, 2);
$fbData = json_decode(base64_decode(strtr($load, '-_', '+/')), true);
if (!empty($fbData["page"]["liked"]))
{ ?>
You are a fan – insert html here
You are not a fan – insert html here
When I remove your PHP script and just use the standard HTML code with file name save as PHP the image shows up fine, so I know if is connecting to my server fine. I remove all the HTML and replace it with the above and everything disappears.
Hello Amy
Are you saving your file as index.php?
Also is your host server able to run php script?
Another alternative to this is to use the static HTML Facebook app.
Let me know if you are stuck.
Yes, I am using index.php for my file and my server is running PHP. I am familar with web and PHP, but new to integrating it into social networks, so I am not sure what a static HTML facbook app is. Any help would be appreciated. I tried many script variations in the PHP file, but none worked.
Install this app below onto your fan page and you will not need to go the PHP route.
http://www.facebook.com/apps/application.php?id=190322544333196
Thank you, that was easy!
Thankyou! We don’t have a PHP server and this was driving me nuts to figure out how to display different content based on whether or not the user has liked the page or not!
You can use the Facebook App called Static HTML to accomplish this now.
For sure i’m gonna use it on my fan page :)
Hi, I am trying my hardest to get this to work but I must be doing something wrong :-( Not sure if facebooks new changes are causing the issue but figured I would ask.
I am basically copying and pasting the code into the body of my index.php page
Once i do this and go to the welcome tab it only gives me a blank white page? Un-like does the same thing. I do have a PHP server so I must be doing something wrong.
Without pasting HTML into your php script should it still work?
Thank you in advance…
Try using the Static HTML Facebook App to do this now.
Thank You Jarrett,
Does this php script no longer work? I used Static HTML Facebook App before I started creating my Fan Page Apps through the FB development area. The only problem with Static HTML FB App is that you can’t customize your tab image.
Any thoughts?
It does still work but Static HTML is easier to deal with.
Hello, I tried to do this app but the button “add to my page” doesn’t exists anymore. What should I do?
Try this app http://apps.facebook.com/static_html_plus/?ref=ts
Sorry sir but, i already installed Statci Html to my Fan Page (Maximum Relax), but i dont know how to continues, where to find the PHP file.
I appreciate your help!
Very well i’m gonna use it on my fan page :)
Well i’m gonna use it on my fan page :)
Please reply with URL.
hi can i hide some of my blog content until they like my facebook fan page? any help would be apprecited.
Yes you can.
I really interested in getting my page liked first before viewing can you help me. I am having lot’s of trouble with the tutorial.
What are you having trouble with?
Hi… can you send me the code for static html?? I want to hide my content on my fan page until someone like it.. I don’t know anything about html… Hope you can teach me… This is my email address Jaidenlkk@hotmail.com… Thx…