Contact Us
  • Facebook Fan Pages – Show Content to Fans – Hide from Non-Fans – FBML – Reveal Tab

    If you want to show content to your fans, and require that a visitor to your Fan Page become a fan in order to view the content, here’s a nice bit of FBML to render content on your Facebook Fan Page only to fans. Easy as pie….

    NOTE: If you’re an admin of the Fan Page you’re using this FBML in, and you’re logged in, you will see the content whether or not you’re actually a fan of the Page. People get confused about this and think the tags aren’t working, seeing either both fan and non-fan content, or one or the other images covering each other.

    ALSO NOTE: You no longer need to have the <fb:fbml version=”1.1″> </fb:fbml> tags, as much documentation on the Web specifies.

    FINALLY: If you want to copy and paste my code, MAKE SURE you convert all quotes to plain-text (straight up and down) quotes! Otherwise, your code will not work!

    See the Troubleshooting Your FBML Code and Testing Your FBML Code sections, below.

    How to Show Different Content to Fans and non-Fans – Reveal Tab

    <fb:visible-to-connection>
    Fans will see this content.
    <fb:else>Non-fans will see this content.</fb:else>
    </fb:visible-to-connection>

    Removing the Space above the Non-Fan Content

    The best way to prevent the non-fan content from pushing the fan content down the page, use this method:

    Use “position: absolute” CSS which takes the non-fan content out of the document flow (See this article on using the CSS absolute-position element) and positions it relative to its containing element (usually a DIV).

    In the following example, I have given the containing DIV the ID “wrapper” and used CSS to style it “position: relative”. Then the non-fans content is in the DIV with the ID “non-fans” and is “position: absolute” and is set to be flush against the left and top margins of the “wrapper” DIV:

    The code in the FBML box:

    <div id="wrapper">
    <fb:visible-to-connection>
    FANS-ONLY CONTENT
    <fb:else>
    <div id="non-fans">CONTENT FOR NON-FANS</div>
    </fb:else>
    </fb:visible-to-connection>
    </div>

    The CSS:

    #wrapper {
    width:520px;
    margin:0 auto; border:0; padding:0;
    position:relative;
    }
    #non-fans {
    width:520px;
    position:absolute; top:0; left:0;
    }

    When using the “position:absolute” in CSS the crucial thing to remember is that the element you’re positioning absolute will be positioned RELATIVE to the element in which it’s contained.

    Troubleshooting

    If you aren’t having success implementing this code, it is most likely due to one of the issues described below. PLEASE carefully read this post and the troubleshooting tips below before asking questions via the comments.

    • IF YOU SEE BOTH FANS-ONLY & NON-FANS CONTENT: To test whether you’ve implemented this feature correctly, you MUST NOT be logged in as an admin for the page you’re adding this to, or you’ll see both the content for fans and for non-fans. The best way to test is to create a user profile for testing and log in as that user. You can then “Like” the page and “un-Like” the page to test the display of content. To “unlike” a page, click on the Wall tab for the page and at the bottom of the left column you’ll see an “Unlike” link. Click that to unlike the page;
    • NO “CURLY” OR “FANCY” FORMATTED QUOTES: Your quotes, whether single or double — and ALL your code — MUST be plain-text. If your quotes aren’t straight up and down, then they’re formatted quotes and should be fixed or your code will NOT work;
    • MATCHING QUOTES: Make sure quotes around values are both the same, either single or double, but they have to match!
    • HEIGHT SETTINGS: My fix for the extra space above the non-fan content uses an example height. Make sure you set the height value and the “margin-top” negative values for your individual case.
    • TEST YOUR URLS: If you can’t access the URL for an image or file directly in your browser, it won’t work in your code. Make sure your URLs are correct;
    • URLS must be properly formed: After the domain name (“TLD”), URLs are CASE SENSITIVE. They should also contain NO SPACES or, as mentioned above, no specially formatted characters.

    Testing your Show/Hide Code

    It’s important to remember that if you’re logged in to Facebook as the user who is the Page admin, you will see both the fans-only and non-fans content.

    To properly test your code:

    • Set up a new Facebook personal profile, to be used just for testing purposes;
    • Log in the Facebook as that new test user and view your Page;
    • If you see the “Like” button at the top, then you’re not yet a fan (duh!);
    • Assuming you’re not yet a fan, you should see the content of <fb:else>;
    • Click the “Like” button; you should then see the fans-only content and the non-fan content will be invisible;

    If you need to do tweaking to the code and re-testing, you’ll have to log out as the test user and log back in as the admin to edit the Static FBML.

    TIP: Open, say, Firefox and be logged in there as the page admin, and do your testing in a different browser (Internet Explorer or Safari) logged in as the test user. Then you can just switch between browsers to edit and test.

    To “Unlike” a Page you’ve Liked, click on the Wall tab and scroll down to the last links in the left column. You’ll see the “Unlike” link:

    So you can toggle back and forth between being and fan and not being a fan to test your code.

    Other Resources

    My Social Media Examiner Tutorial on the Reveal Tab
    Facebook Developer Wiki – fb:visible-to-connection

    NOTE: I have closed comments on this post. If a careful reading of this article doesn’t help you solve your problem with the Reveal Tab, then I probably can’t help. Between the post itself and the many questions and answers, your solution will be found!

    You might also check my recent article: Comprehensive Guide to Static FBML – Adding the Application, Testing, and Troubleshooting.

    • Joe

      The spacing removal doesn’t seem to be working for me, do you have any other suggestions? By the way, thank you so much for all of the great information you are posting to your blog, it has helped me immensely! Keep up the excellent work!!

    • Linde

      Hello,
      great information that has helped me!
      can you please take a look at this website? : [URL REMOVED]

      How do they do it? As in like they ask you to like the page, then suggest to everyone before a link is shown.

      Thanks,
      Linde.

      • http://www.hyperarts.com timware

        How to show/hide content is the subject of this post, and it’s pretty clear. I didn’t look at the page in question.

    • http://facebook.com/rgenzon Rg

      Hello, it’s not working for me.. I’ve tried it for real but then, it’s just not working the way it should.

      • http://www.hyperarts.com timware

        Well, if the answer isn’t in this post or the comments, I doubt I can help. We’ve pretty much covered how to do it and why it might not be working. Mainly, if you’re viewing the page while logged in to Facebook, you will see both the visible and hidden content if you’re either a fan or an admin of the page. You have to test while *not* logged in to FB.

    • CRS

      Help please!!

      I used an FBML box to display some photoslideshows. I successfully made these slideshows visible to only fans of my page. Non-fans just see a blank white box…

      But does anyone know if there is a way to have a message to non-fans like “These slideshows are visible to fans only. To view, click the “Like” button above to become a fan.”

      • http://www.hyperarts.com timware

        Well, yes. That’s the entire subject of this post. Just follow the instructions.

    • http://www.facebook.com/macrobioticsamerica David B

      Hi,

      I’m a huge fan of HyperArts. I couldn’t afford to hire someone to build m fan page, so I built it around your excellent multi-tab code that I bought at the beginning of 2010. And it ended up being 10x more “me” than if I had hired someone to do it. It’s working great by the way, and I HIGHLY recommend it to anyone wanting to create their own fan page. And the fact that it already had built into it the soon-to-be implemented (but WHEN FB, W-H-E-N?) 520px fan page width was a real plus. But that’s not why I’m writing here, so sorry for gushing!

      I have tried every possible way I can see to configure the “no-fan” and “fan” code as instructed above (and they are really great instructions, as usual from HyperArts, thanks), but I get the
      no-fan content blanked out just fine and wonderfully, but the text for the non-fan to see, doesn’t show. I just get the blank screen. (You can see it here at http://www.facebook.com/macrobioticsamerica And I can live with just the blank screen, but I would love to have the non-fan see the text encouraging them to become a fan in order to see the content. I’ve gone as far with it as my code know-how will take me, it seems. Can I send my code to someone at HyperArts and have them fix it for me? I’m ready to pay for it if necessary.

      Thanks much.
      -David B.

      • http://www.hyperarts.com timware

        David, Just post your code here and I’ll take a look. I tried view the “For Fans” tab both as a fan and non-fan and both states show no content. It’s probably an easy fix.

    • http://www.facebook.com/macrobioticsamerica David B

      Hi Tim, thanks for getting back to me. I finally figured out how to get the “non fans” content to show. I missed the “ALSO NOTE” part at the beginning, and by removing those tags as you instructed there, the non-fan content showed up. BUT I haven’t for the life of me been able to get the code right so that the text shows at the top of the page rather than all the way down at the bottom. I’ll keep working on it. BTW: Your pic says it all!

    • Pingback: 5 Effective Ways Businesses can use Facebook | Gold Candor

    • http://facebook.com/provientmarketing Peggy Dolane

      I absolutely LOVE how your H2 (?) headers come with code so that when I cut and paste one into my facebook page as a quote, it automatically generates a link. When I have a bit of spare time, I’m going to have to figure out how you did that.

      • http://www.hyperarts.com timware

        Thanks Peggy! That’s a nifty little service called Tynt. You can log in and get stats on what’s being scraped or copied from your website or blog.

    • Alex

      David how did you move the text to show at the top rather than at the bottom ? Please explain .

    • Chris

      Thank you for writing this article. This is working great for me except that I cannot get the negative top margin working. The fan only image is still taking up the space above the non-fan image. Both images are the same size, any ideas?

    • Kinda

      May I translate your content and put it in my blog and add the link to the source?

      • http://www.hyperarts.com timware

        That would be fine :)

        • Kinda

          Excelent! ;)

    • RM

      Hi could you please take a look at this code? I am trying to display one image linked to a website for fans, and another one telling Non-Fans to “Like” the page to show the content. Right now it works for Fans but for Non-Fans, it just shows a white screen. What am I doing wrong?

      Thanks, here is the code I am using:

      <fb:fbml version="1.1">
      <fb:visible-to-connection>
      <a target="_new" href="http://www.j-vic.com"><img alt="Official J.Vic Website" border="0" src="http://j-vic.com/files/Facebook - Already Fan.jpg" /></a>
      <fb:else><img border="0" alt="" src="http://j-vic.com/files/Facebook - Non-Fan.jpg" /></a>
      </fb:else>
      </fb:visible-to-connection>
      </fb:fbml>

    • RM

      Update: I figured out it wasn’t that the Non-Fan page was white…the image was just still shifted down. The Fan image is still taking up the space above it. I tried you technique with the code below and still have the same problem. Please help when you get a minute. THANK YOU!
      Here’s the current code:

      <fb:visible-to-connection>
      <a target="_new" href="http://www.j-vic.com"><img alt="Official J.Vic Website" border="0" src="http://j-vic.com/files/Facebook - Already Fan.jpg" /></a>
      <fb:else><p style=”margin-top:-700px;”><img src="http://j-vic.com/files/Facebook - Non-Fan.jpg" ></p>
      </fb:else>
      </fb:visible-to-connection>

    • http://www.hyperarts.com timware

      Your link to the non-fans image isn’t correctly. Test it by trying to access the URL directly in your browser. It should go to an image, but it doesn’t.

    • RM

      Thanks for the reply Tim! I tried pasting the link to the non-fan image in the browser and it goes to the correct image (http://j-vic.com/files/Facebook – Non-Fan.jpg). The problem is that when a Non-Fan sees the page, the image is shown but it is shifted far down, underneath the hidden image that is displayed to fans.

      This is the code that I am currently working with, notice that I am trying to shift the Non-Fan image up 700 px, but it doesn’t seem to work:

      <fb:visible-to-connection>
      <a target="_new" href="http://www.j-vic.com"><img alt="Official J.Vic Website" border="0" src="http://j-vic.com/files/Facebook - Already Fan.jpg" /></a>
      <fb:else><p style=”margin-top:-700px;”><img src="http://j-vic.com/files/Facebook - Non-Fan.jpg" ></p>
      </fb:else>
      </fb:visible-to-connection>

      Any help would be greatly appreciated!

      Thank you.

      • http://www.hyperarts.com timware

        You should change the URL of that image. It may be working for you in the browser you’re using, but with Firefox it doesn’t work – it results in this which, for me, is an XML feed. You should NEVER have spaces in URLs, never! Once you’ve sorted that out, why don’t you try the code I suggest in this post.

    • RM

      Sorry, I was logged into my website management tool so the image worked for me but not everyone else. Below is the new code but I am still having the problem with the image for Non-Fans not shifting up when the Fan image is hidden:

      <fb:visible-to-connection>
      <a target="_new" href="http://content.bandzoogle.com/users/jvictorymusic/images/content/Facebook-Fan.jpg?2"><img alt="Official J.Vic Website" border="0" src="http://j-vic.com/files/Facebook - Already Fan.jpg" /></a>
      <fb:else><p><p style=”margin-top:-300px;”><img src="http://content.bandzoogle.com/users/jvictorymusic/images/content/Facebook-Non-Fan.jpg?2&quot; ></p>
      </fb:else>
      </fb:visible-to-connection>

      THANK YOU!

    • RM

      Hey Tim, I’m still having the issue with the above code. Any ideas?

      • http://www.hyperarts.com timware

        You haven’t fixed the image URL which has spaces and shouldn’t have spaces, specifically:

        http://j-vic.com/files/Facebook – Already Fan.jpg

        And you haven’t used the code in this post that I suggest at the very end of the post.

    • RM

      Hi again Tim.

      Well I have tried everything and adding the code at the very bottom of your post does not help. Right now I can see the Fan image but when I am logged out of everything and go to the page, all I see is white.

      Am I doing something wrong? Here is my code, if you have any ideas I’d really appreciate it. If not, no worries. I think I’ll have to give up on this tactic…


      <div style="height:600px;">
      <fb:visible-to-connection>
      <a target="_new" href="http://content.bandzoogle.com/users/jvictorymusic/images/content/Facebook-Fan.jpg?2"><img alt="Official J.Vic Website" border="0" src="http://content.bandzoogle.com/users/jvictorymusic/images/content/Facebook-Fan.jpg?2&quot; /></a>
      </a>
      <fb:else>
      <p style=”margin-top:-600px;”>
      <img border="0" alt="" src="http://content.bandzoogle.com/users/jvictorymusic/images/content/Facebook-Non-Fan.jpg?2&quot; />
      </p>
      </fb:else>
      </fb:visible-to-connection>
      </div>

      • http://www.hyperarts.com timware

        You’re very close.

        First, your images are actually 700px tall, not 600px, so you need to change the “height:600px;” and “margin-top:-600px;” to the correct value of 700px.

        Second, in your <p> tag after the <fb:else>, I think you have “fancy” or “curly” quotes, not plain-text, straight-up-and-down quotes which you MUST have or it breaks things. This is ONE OF THE MOST COMMON ERRORS people make.

        Third, you have an extra </a> tag just before the <fb:else>.

        I tested this with these fixes and it worked perfectly.

    • Bob

      wow. I appreciate your patience!! #27 straightened things out for me and should help many others too!

    • RM

      Tim! Thank you so much. Works perfectly! Sorry for all the back and forth. I think this is a great addition to the facebook site. I will be sure to refer people to your site for this trick.

      Thanks again!

    • Arie

      Hi,

      Great post. However I get a problem when using fb:swf on IE as the visible-to-connection content.

      The link on the preview image of the flash is hidden at the very top and after clicking it the whole flash behaves strangely. buttons do not react. seeing this on IE only. If I use the fb:swf separately on the static fbml..I get no problem. Any idea?

      Here is the code:

      <style>
      .image span{
      background: transparent !important;
      }
      </style>
      <fb:fbml version="1.1">
      <div class="image">
      <fb:visible-to-connection>
      <fb:swf
      swfsrc='http://zibaba.gns.co.il/careline/vac.swf&#039;
      imgsrc='http://zibaba.gns.co.il/careline/pre.jpg&#039;
      width='520' height='562'/>
      <fb:else><p style="margin-top:-562px;">
      <div style="background-image:url(http://zibaba.gns.co.il/careline/landing.jpg); background-repeat: no-repeat; background-position:center center; width: 520px; height: 562px; display: block; position:relative;">
      <a href="http://www.careline.co.il&quot; target="_blank">
      <div style="position:absolute; display: block; width: 210px; height: 37px; top: 246px; left: 48px; border: 1px solid black"/>
      <a href="http://bit.ly/carelineshare&quot; target="_blank">
      <div style="position:absolute; display: block; width: 86px; height: 25px; top: 522px; left: 9px; border: 1px solid black"/>
      </a>
      </div>
      </p>
      </fb:else>
      </fb:visible-to-connection>
      </div>
      </fb:fbml>

    • http://www.jobfish.com/ Sarah M. Weinberger

      Hi (Tim?),

      I noticed that in order for the style parameter in any HTML to work that single quotes and double quotes have strange effects. The only thing that works is whatever character code your special type of double quotes is. I copy and pasted your code above and saw that the double quotes in the fbml is different than in the paragraph tag style attribute.

      Good and Works: ” [ASCII 148]

      Does not work: “, ‘ [ASCII 34 and 39 respectively]

      If I use ASCII 34 or 39, the text gets cut off after the part way through the first paragraph line, whereas using ASCII (or is that ANSI) 148, then everything works. Your code makes that difference. I got the working code by copy and pasting your code above. In a text editor (i.e. TextPad) 148 shows up as a box.

      Thanks in advance.

      • http://www.hyperarts.com timware

        Sarah, I would say to just use plain-text quotes rather than ASCII characters for formatted quotes. This is a problem when copying and pasting my code, and you’ve made me realize I’ve got to call that out more obviously here, and I will! Thanks.

        • http://www.jobfish.com/ Sarah M. Weinberger

          Hi Tim,

          Thank you for writing me back. Plain text resolves down to ASCII codes. Regular plain text quotes is ASCII code 34. I only got into the this code or that code, when I saw the code not work.

          My first attempt was to write the code using my text editor by hand. That did not work. After that I copy and pasted your code, which worked. That led to more hand coding and only after a lot of debugging did I find out that regular double quotes and regular single quotes, both which work in HTML did not work for me for whatever reason. Only your code, not that I know why on that. I could try again, but now that I know a work around, it is not so important. I am merely mentioning it.

          I am just happy that this module exists, as it really does help facebook. Thank you!

    • Mike

      Hi Tim,
      I’m having a problem where my non-fan content is covering up my fan-only content weather you are a fan or not. When you are not a fan it covers it up with the image as desired. However, when you ARE a fan it is covered with “white-ness.”

      I even tried it with the code posted by #26 (along with your corrections from post #27). And I get the exact same result. Any ideas?

    • Mike

      Correction (changed the non-fan offset to match the height of my fan-content):

      <fb:visible-to-connection>
      <div style="height:300px;">
      <table>
      <tr>
      <td><a href="http://www.facebook.com/pages/Neon-Cough/146971614779?v=wall&ref=ts">Wall</a&gt; - Latest news

      about the band.</td>
      </tr>
      <tr>
      <td><a href="http://www.facebook.com/pages/Neon-Cough/146971614779?v=info&ref=ts">Info</a&gt; - Band members and

      bio</td>
      </tr>
      <tr>
      <td><a href="http://www.facebook.com/pages/Neon-Cough/146971614779?v=app_2344061033">Events</a&gt; - Check out

      Neon Cough's upcoming performances and their recent show history.</td>
      </tr>
      <tr>
      <td><a href="http://www.facebook.com/pages/Neon-Cough/146971614779?v=photos">Photos</a&gt; - Live photos on

      stage.</td>
      </tr>
      <tr>
      <td><a href="http://www.facebook.com/pages/Neon-Cough/146971614779?v=app_2392950137">Video</a&gt; - Coming

      soon!</td>
      </tr>
      </table>
      </div>

      <fb:else>
      <p style="margin-top:-300px; z-index:-1;">

      <img style="z-index:-1;" src="http://c2.ac-images.myspacecdn.com/images02/85/l_6f0b99b4fa284849ae8d9e5f9f9d2f29.jpg"&gt;

      </div>
      </fb:else>
      </p>
      </fb:visible-to-connection>

      • http://www.hyperarts.com timware

        You appear to have an extra closing </div> before the </fb:else> tag.

        Also, remember that if you’re viewing the page and your an admin of the page, you’re going to see both the fans and non-fans content.

        I’d also get rid of the z-index style.

    • http://www.djnightlife.com DJ NightLife

      Everything is working fine, except that when you like the page, the content doesn’t show up anymore, the negative margin seems to apply for the ‘new’ content… Help ?

      Here is my code: http://pastebin.com/eyJ4QBCU

      • http://www.hyperarts.com timware

        This is tricky. I tested your code and it’s basically fine. What I would do is 1) transfer styles to an external stylesheet, rather than inlining the styles — creating separate IDs for the top and bottom pieces; 2) Although your rather non-standard way of using HREF tags to include all the styles seems to sort of work, you might try making IDs for each of those 3 linked graphics, assigning all the styles to each, and surrounding those DIVs with the HREF tags.

        I see exactly what you’re seeing.

        One thing, you don’t need the single quotes around the URLs in the url( …. ) styles. Just: url(http://…… .jpg);

        Let me know how it turns out. Nice designs, BTW.

        • http://www.djnightlife.com DJ NightLife

          http://www.w3schools.com/css/pr_background-image.asp

          Says the single quotes are required on background-image property.

          And what do you mean by “non-standard way of using href” ?

          Are you sure Facebook can handle a link tag to an external stylesheet?

          • http://www.djnightlife.com DJ NightLife

            Honestly, I gave up… With a tag it ended that only admin side could see the design, it was completely blank for other users. I’m so tired of Facebook with their weird non-standard coding.

            I’ll let it with a “Click like” mention even for ‘already fans’.

    • http://www.hyperarts.com timware

      DJ Nightlife: Although most browsers will handle quotes around the background-image URL property, it’s non-standard and ill-advised, regardless of what W3 School says. I learned CSS years ago and have stayed up on it and Eric Meyer and the other “gurus” of CSS don’t use quotes and apparently some browsers choked on the quotes. Although they’ll usually work, because Facebook is such a weird & unpredictable platform on which to develop, I’d stick to the tried & true. There’s my 2c on that.

      Generally, it’s better to use external stylesheets with Facebook, although the server on which they cache your stylesheets sometimes goes down, but I’ve found that overall it’s better to go the external route. And easier to maintain.

      What I meant by non-standard method of using the HREF tag is that you’re turning it into a container object and not linking an object — surrounding text or an image — with the <a href….></a> tags. Although it seems to be working somehow, I’ve never seen this done and I believe it’s not a good way to do it and, again, with Facebook, I’d stick close to standard use of CSS.

      Take it or leave it, and it looks like you’re leaving it.

    • Subail Sunny

      hello tim,
      i want to create a tab that will check the user whether he is a fan or not. if he is a fan then it will show a link. by clicking that link a textarea will show up. if click the link the box is not showing up. my code is given below.

      [ FBML deleted ]
      <script type="text/javascript">
      <!--
      function show_box(){
      var code="<textarea cols='45' rows='6' readonly='readonly' >We will soon supply the CODE.</textarea>";
      document.getElementById('box').setInnerFBML(code);
      }
      //-->
      </script>

      please help me out. i am not understanding the java script part. will u make correction of my code? please

      • http://www.hyperarts.com timware

        Your FBML looked fine. I can’t provide support for JavaScript or FBJS. Sorry.

    • Casey

      It took my reading the entire comment stream but I finally made my code work! Thanks so much Tim!

      One side note, I did not understand at first that the tags required the as well. Once I made that fix, I was golden!

      http://www.facebook.com/pages/CLB-Social-Communications/133815816653470?v=app_6009294086

    • yan

      Hello Tim.
      Thank you for the usfull info.
      I have a problem with my code. im getting a blank white square after a person pressed the like button. it seems like the non-fan contant is overlapping the fan contant.
      here is my code:

      <fb:fbml version="1.1">
      <fb:visible-to-connection><img border="0" alt="" src="http://i1035.photobucket.com/albums/a432/yanroz/5bf32dce.jpg"&gt;
      <fb:else><p style="margin-top:-720px;"><img border="0" alt="" src="http://i1035.photobucket.com/albums/a432/yanroz/mey-tav_plus_like.jpg"></p&gt;
      </fb:else>
      </fb:visible-to-connection>
      </fb:fbml>

      Thanks
      Yaniv

      • yan

        iv fixed the height isue but still the same result – please advise.


        <fb:fbml version="1.1">
        <div style="height:610px:">
        <fb:visible-to-connection>
        <img border="0" alt="" src="http://i1035.photobucket.com/albums/a432/yanroz/5bf32dce.jpg"&gt;
        <fb:else><p style="margin-top:-610px;"><img border="0" alt="" src="http://i1035.photobucket.com/albums/a432/yanroz/mey-tav_plus_like.jpg"></p&gt;
        </fb:else>
        </div>
        </fb:visible-to-connection>
        </div>
        </fb:fbml>

        thanks

      • http://www.hyperarts.com timware

        You have a colon “:” instead of a semicolon:

        <div style=”height:610px:”>

        and remove the extra </div> before the </fb:visible-to-connection>

        • http://www.cagloo.com Divyesh Ardeshana

          Hello

          Still above code is not work.

          Thanks

    • Sean

      Hi there,

      just came across this website in my search for a solution.

      I want to post a piece of content on a website just to users that have liked the page (nothing to do with Fan page or being a Fan etc)
      is this possible ?

      Tnx
      Sean

      PS : Great job on your site – looks like a mine of info, and ill check it out in more detail shortly !

    • Boaz

      It looks like the behavior is different between IE8 and Firefox. I have a very simple test code:

      thank you for being our fanplease press the like button

      On FireFox it works great but on IE when I like the page, the ‘non fans’ blank area, which is ‘pulled up’ by the negative margin, hides the fans text.

    • Boaz

      Here is another solution that works on IE8, Firefox, Chrome (without using the negative margin method):

      <div>
      <div style="height: 800px;">
      <fb:fbml version="1.1">
      <fb:visible-to-connection>
      <div style="position: absolute; top:0px;left:0px; width:100%; background-color:white">
      thank you for being our fan
      </div>
      <fb:else>
      please press the like button
      </fb:else>
      </fb:visible-to-connection>
      </div>
      <div>

      • http://www.hyperarts.com timware

        Yes, absolute positioning can accomplish this, although it can also cause problems (but so can any code in the hands of the inexperienced!). As long as the absolute-positioned element is inside a containing element (eg DIV) that is set to “position:relative” it should be okay. Thanks!

      • yaniv

        Hi Boaz
        Works like a charm!
        10x! :)

    • http://www.SocialRabbit.net Lara

      Thank you soooooooo much for this Tim, it took me a while as a complete non-html person, but I finally have it working!!!

    • Kathleen

      Tim, I’m wondering if there is a way to hide the non-fan content from the fans.

      For example, if you have something the non-fans see like “To see this content, click the Like Button”, can you hide that from your fans?

      Thanks

      • http://www.hyperarts.com timware

        As clearly laid out in this post, this is exactly how it works. When a user “likes” the page, the fan content shows and the non-fan content disappears.

    • Kathleen

      As usual, you’re right. I was doing 10 things at once earlier, and missed that. Sorry. Great post.

    • http://sleepLessInNewYork.wordpress.com Sandeep Chouksey

      Hey,

      Can you hide entire tabs for non-fans? Only display the tab if its liked? Or does this only apply to content within the tabs?

      Thanks.
      Sandeep

      • http://www.hyperarts.com timware

        That is a good question! You can’t do it with the top main tabs (Wall, Info, YourTab, YourTab), I don’t believe. You could probably do it on our multi-tab subnav as seen on our HyperArts fan page, but I don’t think that’s what you’re asking.

        • http://sleepLessInNewYork.wordpress.com Sandeep Chouksey

          Yeh, I would like to entire tab element to now show up if you are a non-member and show up and be clickable if you are a member. But doesn’t seem like that can be done.

          But here is another question? Is it possible to set it such that non-members can’t see the facebook fan page wall?? I don’t see it anywhere in the settings.

          • http://www.hyperarts.com timware

            Can’t be done, as far as I know. I suppose Facebook wants to discourage gated communities.

    • Tess Losen


      <div style="height:648px;">
      <fb:visible-to-connection>
      <a href="http://www.johngroupinteractive.com/client_images/sunbelt/SUNBELT_July_Coupon.pdf"><img border="0" src="http://www.johngroupinteractive.com/client_images/sunbelt/8417_coupon_1.jpg&quot; /></a>
      <fb:else>
      <p style="margin-top:-648px;">
      <img border="0" src="http://www.johngroupinteractive.com/client_images/sunbelt/8417_coupon_2.jpg&quot; />
      </p>
      </fb:else>
      </fb:visible-to-connection>
      </div>

      I cannot figure out why this isn’t working. The only image that’s appearing is the fans-only image, and it isn’t linking to the pdf. I’m sure it’s a simple fix. Any thoughts?

      • http://www.hyperarts.com timware

        I tested this and it works for me. However, you have the 2 images reversed. If one is a fan they see coupon_1 which is the image that DOESN’T ask the user to become a fan.

        And remember that if you’re an admin of the page and logged in to facebook, you’ll see both versions and, with the negative margin, one image will cover the other.

    • Mark Thomas

      Hey Tim,

      I am having an issue with this code. Can you help me out? Once the page is “liked” the content shows up fine but when it’s not liked there is a white page……

      <style type="text/css">
      .video{
      position:absolute;
      margin-left:380px;
      top:396px;
      width:640px;
      height:385px;
      left: -320px;
      }

      </style>

      <div style="height:800px">
      <fb:visible-to-connection>
      <div class="video">Test</div><table id="Table_01" width="760" height="800" border="0" cellpadding="0" cellspacing="0">
      <tr>
      <td colspan="3" background="http://vagrant.com/schoolofsevenbells/windstormpremiere/images/index_01.jpg&quot; width="760" height="396" alt="">
      </td>
      </tr>
      <tr>
      <td rowspan="2" background="http://vagrant.com/schoolofsevenbells/windstormpremiere/images/index_02.jpg&quot; width="60" height="404" alt="">
      </td>
      <td background="http://vagrant.com/schoolofsevenbells/windstormpremiere/images/video.jpg&quot; width="640" height="385" alt="">
      </td>
      <td rowspan="2" background="http://vagrant.com/schoolofsevenbells/windstormpremiere/images/index_04.jpg&quot; width="60" height="404" alt="">
      </td>
      </tr>
      <tr>
      <td background="http://vagrant.com/schoolofsevenbells/windstormpremiere/images/index_05.jpg&quot; width="640" height="19" alt="">
      </td>
      </tr>
      </table>
      <fb:else><p style=”margin-top:-800px”><img src="http://vagrant.com/schoolofsevenbells/windstormpremiere/images/sviib-non.jpg"/></p></fb:else&gt;
      </fb:visible-to-connection>
      </div>

      • http://www.hyperarts.com timware

        I would try using the absolute positioning for the fb:else, as described in a comment above. Just remember that an absolute-positioned element has to have the container that it’s positioned relative to be set to: position:relative.

        Then remove the DIV with the height set to 800px and the <p> tag that has the negative margin. I’m going to be updating this post to propose the use of absolute positioning to address the fan-only content pushing the non-fan content below it.

    • Dan

      I have a simple code (I think) that I just cant get to work..

      I either get the white space problem, or when that is solved (div worked kinda), my video disappears. Wondering what I am doing wrong. Thanks


      <fb:fbml version="1.1">
      <div style="height:323px;">
      <fb:visible-to-connection>

      <img src="http://i29.tinypic.com/ztjj7m.jpg"&gt;

      <fb:else>
      <p style=”margin-top:-323px;”>
      <img align="left" src="http://i29.tinypic.com/b7m8ap.jpg"&gt;
      <fb:swf
      swfsrc='http://www.youtube.com/cp/vjVQa1PpcFP2MipgqlnLEieOY_UaFaW1gZS5H2mbkDw=&#039;
      imgsrc='http://i28.tinypic.com/2053ukp.jpg&#039; width='247' height='323'/>
      </p>
      </fb:else>
      </fb:visible-to-connection>
      </div>
      </fb:fbml>

      • http://www.hyperarts.com timware

        I believe the problem is some “curly” or “fancy” quotes around “margin-top:-323px;” Change those to straight up and down plain text quotes and it works fine.

        • Dan

          Thank for the reply. Having a slight problem where for some reason the fan image is higher then the nonfan image and leaving a white line through the nonfan image, but I can prob figure that one out on my own. Unless there is a real simple thing that is messed up. I am new to this type of coding.

          Thanks Again

    • http://forexreviewjournal.com/ noam

      hey i am having problems with this…
      i am willig to pay to have this done for me..
      please contact me at noam46@hotmail.com

    • Antoine

      I’ve managed to get the empty spaces out but i’m still facing the picture A when FAN and NON-FAN…
      Please help !!!!

      • http://www.hyperarts.com timware

        Have you read this post carefully? Remember, if you’re a page admin you’ll see both the fans and non-fans content when viewing the page, whether or not you’re a fan of the page. And check your URLs.

    • http://www.sarahwalraven.com Sarah

      This post made my day. Between the original post, comments 27 and 28, and plenty of trial and error, I’ve got it figured out. I’m just learning Facebook pages and this was hugely helpful.

      Awesome job and I love your comment responses. :)

    • http://www.guardraildamageahead.com @scottayres

      Thanks for this post. But I’m curious. Is there a way to make it such that non fans can’t even click on other tabs? Making it where they can only see your Welcome tab?

      • http://www.hyperarts.com timware

        If you mean the top tabs (Wall, Info + yours), I don’t think you can hide these from non-fans. Just content within the tabs.

    • Shamesun

      Thank you for your time.

      I am using the code below. The non-fan content shows up fine, but when I click “like” then the fan content isn’t displaying correctly. Only the bottom part of the image is displaying.


      <div style="height:631px;">
      <fb:visible-to-connection>
      <img src="http://www.talbots.com/images/callout/FaceBook/50Like_FanPromo.jpg&quot; alt="Thanks to everyone who helped us reach our goal of 50,000 fans. Here's an exclusive offer just for you - our fans! 20% off all full-price items online now through Saturday, August 7. Use offer code FB50K." width="750" height="631" border="0">
      <fb:else>
      <p style="margin-top:-631px;">
      <img src="http://www.talbots.com/images/callout/FaceBook/50kLike.jpg&quot; alt="Help us reach our goal of 50,000 Facebook fans. Like our page and get an exclusive offer - just for fans, which we'll post on Friday, August 6!" width="750" height="560" border="0">
      </p>
      </fb:else>
      </fb:visible-to-connection>
      </div>

      • http://www.hyperarts.com timware

        I tested on Firefox & Safari on Mac and it’s working fine. I’m seeing the full fan content image after liking the page.

    • Shamesun

      It does work in Firefox, but not in IE.

      • http://www.hyperarts.com timware

        Which version of IE? If IE 6, to be expected. I wonder if IE is choking on all or some of that content in the ALT tags? You might try taking that out and testing, or at least shortening and simplifying it. It’s a lot of content for an ALT tag. Also, make sure you’re viewing the page from an account that ISN’T an admin of the page.

        Also, is the bottom half that’s displaying after user Likes at the top margin of the page, or pushed down as if something is blocking it?

    • Shamesun

      I’ve tested in IE6 and IE7 with the same result. I’ve shortened the alt tags. The part of the image that is displaying is towards the bottom margin, but if the whole image were displaying, I think it would be there anyway. It’s just that the top half of the image isn’t showing. There looks to be a single bar of color, almost like it’s getting squished.

      • http://www.hyperarts.com timware

        Are you viewing the page while logged in as the page admin? Make sure you’re testing while logged in as a non-admin user.

        It works in IE 8.

        Well, you might try using absolute positioning to deal with the fan-only content pushing the non-fan (fb:else) content down the page after the page is liked.

    • Dennis

      Hi Tim, is there a way to hide a specific custom FBML tab to non-fans?

    • http://www.facebook.com/breakfastcookie Deja

      Okay, I actually managed to *almost* get this working right. Here’s my code:


      <style type="text/css">
      #wrapper {
      width:520px;
      margin:0 auto; border:0; padding:0;
      position:relative;
      }
      </style>

      <div id="wrapper">
      <fb:visible-to-connection><p style="margin-top:0px;"><img src="http://www.bbcookies.com/sm/fans.jpg&quot; height="520" width="520" /></p><fb:else><p style="margin-top:-520px;"><img src="http://www.bbcookies.com/sm/nonfans_new.jpg"></p></fb:else></fb:visible-to-connection></div&gt;

      This works perfectly in Safari 5, Firefox 3.6, and IE 6 & 8, but does not display properly in IE 7 (after clicking “like” you don’t see the fan content, just white space).

      Help Please??

      • http://www.hyperarts.com timware

        Well, I’m beginning to sound like a broken record, but if you want your page to display the styles with INTERNET EXPLORER v8, DON’T USE INLINED STYLESHEETS! They’re not working anymore and I don’t know if they ever will again. You say it is working in IE 8, but I doubt that’s true. Double check that.

        HOWEVER, I would also suggest you use the newer method of getting rid of the white space created by the invisible fans-only content, which involves absolute positioning.

    • Amber

      Will this work with posted videos? I’m a complete novice so be gentle. Thanks in advance!

      • http://www.hyperarts.com timware

        Hah! Am I really seen as that rough :) I must DO something about that!

        I don’t understand “posted videos”? You can use pretty much any URL for the “swfsrc” value as long as it points to a Shockwave Flash (SWF) object. More info is available on the Facebook Developers site.

        Cheers!

    • Taylor

      I was having the problem where the spacing wouldn’t go away at the top of my “non-fans” image. Your solution worked though so thank you so much!

    • Pingback: Three Community-Engaging Facebook Fan Page Techniques

    • angelag giesel

      if i’m using <fb:visible-to-connection></fb:visible-to-connection> the full content is still visible even to non-fans in the source code…
      so i don’t think this is really a good solution. however does anybody know how to REALLY hide content from non-fans so it isn’t even visible in the source code?

    • R0meo

      How to NOT show facebook fan page WALL and any other info of the fan page while user is non-fan

      any suggestions?

      • http://www.hyperarts.com timware

        No way that I’m aware of. How would someone become a fan if they couldn’t see anything on your Page? No, you can’t hide the Wall tab by any means.

    • http://kcrazy.com Razu Kc

      Do you know some way to hide the entire left portion of the fan page? Those include people who like the page, other info, links, notes etc. I wan to want to add a Static FBML page, of greater width and its only possible if i could somehow not show the left portion.

      • http://www.hyperarts.com timware

        No way, man.

    • Pingback: How to Run a Contest on Facebook

    • Pooja Gandhi

      Is it possible to hide the photos in albums from non fans

    • http://www.urbanvivant.com Carolyn K.

      Works like a charm, thank you so much! We had an image to display to fans only, and some text for non-fans encouraging them like us. Thank you for the directions, they were perfect :)

    • http://www.jeremylockhart.com Jeremy Lockhart

      Still having issues using CSS to position the 2 div’s absolutely. I had to resort to using a background image on the div for non-fan content and then putting my fan content over top of it covering it.

    • D Webb

      Jeremy – thanks for the tip. I was getting the divs to work correctly in FF but IE was still creating the empty space at the top of the page. I used Jeremy’s suggestion of a background image, which worked fine but disallowed the use of any complex content.

      • http://www.hyperarts.com timware

        The key thing in using absolute positioning to account for the fan-only content space is to MAKE SURE that the DIV that contains the absolute-positioned DIV is set to “position: relative”. Then the absolute-positioned DIV will be positioned relative to that containing DIV using the top/bottom and left/right parameters.

    • Katie Bolson

      Here’s the code I’m trying to use for having non-fans see one image, and fans see another image. Problem is, when I have a 3rd party person(non admin) try it, they see both the non-fan image and the image for just fans. Is there a way to make it so that the person sees 1 image before they are a fan, and then just the 2nd image after? I’ve tried a bunch of variations but I feel like I’m missing something!

      Thanks!!

      Here’s my code


      <img width="520" src="http://farm5.static.flickr.com/4102/4948756057_2486809f4b_z.jpg"&gt;
      <fb:visible-to-connection>
      <img width="520" src="http://farm5.static.flickr.com/4149/4948756177_bceed2267c_b.jpg"&gt;
      </fb:visible-to-connection>

      • http://www.hyperarts.com timware

        Katie, You should read this tutorial more closely. It should be obvious what you’re doing wrong here.

        • Marie Doggle

          What’s obvious to some may not be to others. Would have been much more helpful to just answer the question and/or point her in the right direction instead.

          • http://www.hyperarts.com timware

            If Katie had read this tutorial carefully, it would not have resulted in her code, and it would take me longer to re-explain it than to just point out her answers is already here. I try to be as helpful as I can given the limitations of time.

    • http://www.twitter.com/madikarizma Matthew Martindale

      This worked for me and might be a simpler route. Thanks to this article, my mind was put on the right track to come up with my version of the solution.


      <fb:visible-to-connection>
      <style type="text/css">.fancontent{display:block}</style>
      <fb:else>
      <style type="text/css">.fancontent{display:none}</style>
      </fb:else>
      </fb:visible-to-connection>

      • http://www.twitter.com/madikarizma Matthew Martindale

        This code is, of course, followed by the actual content:


        <div class="fancontent">Imagine content here...</div>

        • http://www.hyperarts.com timware

          Matthew: Can you provide the URL where this worked, as well as the browser and platform (Mac or Windows)? I couldn’t get your “solution” to work in FF or Safari on Mac, or IE 8 on the PC, at which point I stopped testing.

          Even if it did work somewhere, I would not advise using inlined <style> tags at all on Static FBML tabs.

          A slight modification to your approach that would work is just inlining the styles within the HTML tags: <div style=”display:block”>, for example.

    • http://www.twitter.com/madikarizma Matthew Martindale

      My apologies. My previous code stopped working and I am not sure why. However, I did find another solution with less code:


      <div><!--fan content open tag-->
      <fb:visible-to-connection>
      - fan content here -
      </div><!--fan content close tag-->
      </fb:visible-to-connection>

      I would say it’s more of a hack than a standard practice. However, it works and at least it is Facebook and not your site that is considered “non-standard”. :p

      • http://www.hyperarts.com timware

        What is your logic here? You open a DIV, then open an FBML tag, then close the DIV before closing the FBML tag. If this works on some browser, I think it’s a fluke.

        I appreciate that your trying to really minimize the code for the fans only content method, but my approach is probably as minimal as you’ll get while still getting it to display properly over all browsers and platforms.

        Also, there’s no <fb:else> tags, so I guess you’d just have some content for fans and no content for non-fans?

        • http://www.twitter.com/madikarizma Matthew Martindale

          I think the bigger problem is Facebook not making a simple function easy to work with. No matter how you get it to work for you, it’s not exactly ideal.

          Your approach is definitely working, which is more than I can say after discovering this morning that my approach had stopped working (some of my issues might be due to caching, however). The logic behind the second solution I provided was someone else’s, and I can’t find the blog URL (sorry). At the time, it worked in all browsers, and it seemed to work for many others.

          From what I have discovered, even is inconsistent.

    • http://www.facebook.com/tipsandtricks1 selina

      how do i hide the ‘non-fans’ part, after someone likes my page.

      • http://www.hyperarts.com timware

        Selina, You should get in the habit of reading tutorials closely before posting questions. As it says in the red NOTE near the beginning of this article, if you’re logged into Facebook as a page admin while viewing the tab, you’re going to see both fans and non-fans content.

    • Alex Holigores

      Thanks for the help with this, it’s working great! Does anyone have any idea how to add comments to the “visible-to-connection” page only, and not fb:else?

      Thanks!

    • Bien

      Great info! Thanks a lot! Enjoying FBML!

    • shane guitar

      How do you get rid of the gaps between images?

      • http://www.hyperarts.com timware

        Add to the <img … /> tag: style=”display:block”

    • Miriam

      Thank you for this excellent tutorial. I want to test my two versions of the tab, but will it have to be live and visible to all Facebook users while I’m testing?

      Or is there some way to test it while having it still hidden from the general public?

      I’m assuming not, since I need a non-admin test account to test it, but I thought you might have a suggestion.

      Thanks in advance!

      • http://www.hyperarts.com timware

        I suggest you set up a new Page for testing purposes. Or, alternatively, keep the new tab under the “>>” rather than appearing in the main tab set.

        • Miriam

          Thanks for the quick response!

    • Miriam

      Hello again,

      I got my FBML page working fine in FireFox and IE8. But in IE7 it comes up blank. This is the code I’m using:


      Any thoughts on how to resolve this?

      Thanks much!

      • Miriam

        Hello again,

        I got my FBML page working fine in FireFox and IE8. But in IE7 it comes up blank. This is the code I’m using:

        <fb:fbml version="1.1">
        <div style="height:728px;">
        <fb:visible-to-connection>
        <a href="http://www.cavitcollection.com/html/cgpc2010_winner.html&quot; target="_blank">
        <img src="http://www.cavitcollection.com/html/cgpc/fbtab_like.jpg&quot; width="520" height="728" / border=0></a>
        <fb:else>
        <p style="margin-top:-730px;">
        <img src="http://www.cavitcollection.com/html/cgpc/fbtab_nolike.jpg&quot; width="520" height="728" /></p>
        </fb:else>
        </fb:visible-to-connection>
        </div>
        </fb:fbml>

        • http://www.hyperarts.com timware

          First, fix the <img /> tag right after <fb:visible-to-connection> – the forward slash after height=”728″ is, as you probably know, misplaced; it should be just before the “>”.

          If that doesn’t fix the issue, also try removing the <fb:fbml version=”1.1″> and </fb:fbml> tags. I don’t believe they’re necessary anymore.

          • Miriam

            Thank you. I fixed the tag and removed the other tag, and it still doesn’t show up. Any other possibilities?

    • http://www.hyperarts.com timware

      Miriam: Clear your cache?

      • Miriam

        Did that – twice. No dice.

    • http://www.facebook.com/clbsocialcommunications Casey

      This solution works great in FF and Safari. The content display works in IE but I’m still getting the gap at the top of the page for non-fans because IE doesn’t read the CSS, I guess. I’ve read your update post about CSS in IE and I’m still not finding a solution. I’m somewhat of a novice so any help or direction is much appreciated. My code is:


      <style type="text/css">
      #wrapper {
      width:520px;
      margin:0 auto; border:0; padding:0;
      position:relative;
      }
      #non-fans {
      width:520px;
      position:absolute; top:0; left:0;
      }
      </style>
      <div id="wrapper">
      <fb:visible-to-connection>
      <div style="display:block; width:520px; height:450px; background:url(http://i1027.photobucket.com/albums/y334/cabrewton/CLBSCFBFansLandingPage-2.jpg); position:relative; margin:2px auto 2px auto;">
      <div><a style="left:260px; top:277px; background:transparent; display:block; width:98px; height:0; padding-top:34px; overflow:hidden; position:absolute;" title="Wall" href="http://www.facebook.com/CLBSocialCommunications"></a></div&gt;
      <div><a style="left:172px; top:326px; background:transparent; display:block; width:147px; height:0; padding-top:34px; overflow:hidden; position:absolute;" title="Contact" href="http://www.facebook.com/CLBSocialCommunications?v=app_7146470109"></a&gt;
      </div>
      </div>
      <fb:else><div id="non-fans"><img src="http://i1027.photobucket.com/albums/y334/cabrewton/CLBSCFBNon-FanLandingPage-2.jpg&quot; border="0" alt="520px Fan"></div></fb:else>
      </fb:visible-to-connection>
      </div>

    • Lou

      Hi Tim! i just want here to show videos on my wall to fans only. and can i do it. the FBML tab is already created, the image is there with the mention ”click LIKE to see videos”. but i can’t figure out the way to hide my wall from non-fans. can i put my videos on another tab? what’s the best option. thank you for your time in advance.

      Lou

      • http://www.hyperarts.com timware

        You can’t hide your Wall from non-fans. Using the fan-only fb:visible-to-connection on a custom Static FBML tab you could do that, but not on your Wall.

    • James

      Hi Tim,

      I am facing one critical problem.

      I have one application in which i am using the FBML and php, i want to display multi-friend selector control to by fans.

      But i put the below code

      You are fan of this application

      I am getting the this error

      fb:profile-action: Required fbml_env var missing:

      Although the same code is working fine in the static fbml but not in my application php page.

      Urgent help needed.

      Thanks

    • James

      Hi tim,

      sorry for posting again because i miss the code part
      I am facing one critical problem.

      I have one application in which i am using the FBML and php, i want to display multi-friend selector control to by fans.

      But i put the below code

      <fb:visible-to-connection>
      <p>You are fan of this application</p>
      </fb:visible-to-connection>

      I am getting the this error

      fb:profile-action: Required fbml_env var missing:

      Although the same code is working fine in the static fbml but not in my application php page.

      Urgent help needed.

      Thanks

      • http://www.hyperarts.com timware

        The fb:visible-to-connection FBML tag doesn’t work in canvas applications. That’s the error you get when trying to use it.

    • Del

      Is it possible to hide the entire FBML tab to non-fans, as opposed to just the content within the tab?

      • http://www.hyperarts.com timware

        Nope.

    • James

      Thanks Tim,

      Then how can i hide the content to non fans into my canvas page ? Is there any way ?

    • http://facebook.com/texasdepartmentofagriculture Becky

      I did an FBML tab, and it’s only showing up for fans go on the page. I didn’t add any code to make this happen. But I want EVERYONE to see the same page. Fans or non-fans. Any ideas?

      • http://www.hyperarts.com timware

        Are you using the fb:visible-to-connection FBML tag? If so, what is the content for fb:else?

        If you didn’t use the fb:visible-to-connection tag, then I’m not sure why you’re having that problem.

    • tayo

      Hi,is there a way(manually) I can block fans from posting comments and clicking on ‘like’ on my wall posts?On the alternative,is there an FBML code I can use to solve this problem

      • http://www.hyperarts.com timware

        You can edit your Wall settings. Click on “Edit Page” under your logo/avatar, then click “Wall settings”.

        • tayo

          i tried editing my wall settings to remove the ‘comment’ and ‘like’ options.Unfortunately,I can still see both options on my face book fan page wall.Is there an alternative?Thanks.

    • Tim

      Hi Tim..

      Nice post…

      I have the same problem as:
      #33 Casey – September 16th, 2010 at 09:24

      Just didn’t want to repeat the issue again,

      Can you please have a look and let us know if you have any suggestions?

      Thanks,
      Tim

      • http://www.hyperarts.com timware

        Casey’s and your problem is using the <style> … </style> tag to inline styles. These just aren’t working with IE, definitely not in IE 8. You have to use an external style sheet or, if you just don’t know how to do that, then you have to inline the styles right within the HTML.

    • http://www.thescube.com Shovan

      Hello,

      It works thanks,

      I want to link the link button in my FB Design

      How can i do that? You can have a look here
      http://www.facebook.com/TheDigitalMedia

      or just the image here
      http://img3.imageshack.us/img3/1569/liket.png

      I want to link this image, so when user click on it, they automatically like the page.

      This is the XFBML code, it dosent work when I included in the XFBML

      <fb:like href="http://www.facebook.com/TheDigitalMedia&quot; layout="button_count"></fb:like>

      Iframe code

      Thanks a lot, sorry about the long response

      • http://www.hyperarts.com timware

        This can’t be done. No way to have a “like” button on your Page, in FBML.

        • Tim

          Is this page putting the “like” button on the fan page?

          http://www.facebook.com/webwhispers?v=app_6009294086

          or thing is something else?

          • http://www.hyperarts.com timware

            That link just goes to the Page’s Wall. You can’t put a stand-alone Like button on a Static FBML page. It gets coupled with the comments box.

    • Cole

      Any help, this loads the non-fan page in IE, but once “liked”, it does not load the “fan” content.


      <fb:fbml version="1.1">

      <a href="http://www.site.com/images/facebook.css&quot; rel="stylesheet" type="text/css" />

      <div style="height:650px;">
      <fb:visible-to-connection>

      <img src="http://www.site.com/images/facebook/fan.jpg&quot; width="520" height="650" border="0"/>

      <fb:else><p style="margin-top:-650px;"><img src="http://www.site.com/images/facebook/non_fan.jpg&quot; width="520" height="650" border="0/></p></fb:else>

      </fb:visible-to-connection>
      </div>

      </fb:fbml>

      I am not sure, what I need to change on the css file.

      Here is the css text:


      #wrapper {
      width:520px;
      margin:0 auto; border:0; padding:0;
      position:relative;
      }

      #non-fans {
      width:520px;
      position:absolute; top:-650px; left:0;
      }

      • http://www.hyperarts.com timware

        You’re not using the correct tag to link to external CSS. It should be:

        <link rel=”stylesheet” href=”URL TO STYLESHEET” />

        Also, I would use my absolute-position method to get rid of the extra white space, instead of the negative margins, as described above.

    • StalkerB

      How come this code doesn’t show ‘Paragraph 2′ (but otherwise works)?

      <fb:fbml version="1.1">
      <fb:visible-to-connection>
      <p>Paragraph 1</p>
      <p>Paragraph 2</p>
      <fb:else><p style="margin-top:-50px;">Please 'Like' the page to see the latest information.</p></fb:else>
      </fb:visible-to-connection>
      </fb:fbml>

      • http://www.hyperarts.com timware

        After a user has liked the page, Facebook hides the non-fan content with the “visibility:hidden” style which hides the content but reserves the space. So the non-fan content, with a top margin of -50px is cutting off your last lines of fan content.

        The non-fan content is pushed down by the fan content, but will hide the buttom 50px because of the negative margin.

        I suggest using the newer solution to getting rid of the white space which involves using absolute positioning and is described above.

        • StalkerB

          I see.

          I didn’t realise I could use <style type="text/css"> to style stuff.

          This. Changes. Everything!

          Lol, thanks.

          • http://www.hyperarts.com timware

            I didn’t recommend you use the <style> tag to inline styles! It won’t work with Internet Explorer. You have to use an external stylesheet, or inline the styles in the HTML tags.

          • StalkerB

            You telling me this is wrong? Seems to work in IE.

            <style type="text/css">#wrapper {
            width:520px;
            margin:0 auto; border:0; padding:0;
            position:relative;
            }
            #non-fans {
            width:520px;
            position:absolute; top:0; left:0;
            }
            </style>

            <div id="wrapper">
            <fb:visible-to-connection>
            <p>Paragraph 1</p>
            <p>Paragraph 2</p>
            <fb:else>
            <div id="non-fans"><p>Please 'Like' the page to see the latest information.</p></div>
            </fb:else>
            </fb:visible-to-connection>
            </div>

    • http://www.hyperarts.com timware

      Does it work with IE 8? That browser has been very undependable in rendering inlined styles. But maybe Facebook recently changed something. My advice is to use external stylesheets as that approach has been the most dependable.

    • Cole

      timware :
      You’re not using the correct tag to link to external CSS. It should be:
      <link rel=”stylesheet” href=”URL TO STYLESHEET” />
      Also, I would use my absolute-position method to get rid of the extra white space, instead of the negative margins, as described above.

      Thanks for the info, it is working perfectly. I went ahead and changed to using the absolute positioning method.

    • tuba

      Hey Tim,

      Thank you for the great Tutorial. When I used to code the content visible-to-connection works fine but content for non-fans is not available to non fans. If you haven’t liked the page yet you just see empty fbml page. Can you please tell me what I am doing wrong? The code i seed id below.
      Thank you!


      <style type="text/css">
      #wrapper {
      width:520px;
      margin:0 auto; border:0; padding:0;
      position:relative;
      }
      #non-fans {
      width:520px;
      position:absolute; top:0; left:0;
      }
      </style>
      <div id="wrapper">
      <fb:visible-to-connection>
      <href="http://www.redtri.com/insiders-guide-to-the-kidaroo-music-festival/&quot; title="Kidaroo Music Festival"><img src="http://farm5.static.flickr.com/4104/4992076264_49c82d74a6_b.jpg&quot; width="520" height="916" alt="Kidaroo Music Festival" /></a><p><fb:share-button class="url" href="http://www.facebook.com/red.tricycle.sanfrancisco&quot; /> <p><div id="_mcePaste" style="padding-top: 15px; padding-bottom: 15px;"><a href="http://www.facebook.com/note.php?note_id=146685938697901"><strong>Contest Rules</strong></a></div><p>
      This promotion is in no way sponsored, endorsed or administered by, or associated with, Facebook.
      You understand that you are providing your information to the administrators of this page and not to Facebook.
      The information you provide will only be used for communications related to this promotion.

      </div>
      <fb:else><div id="non-fans"><img src="http://farm5.static.flickr.com/4093/4943680681_34c486a6b7.jpg&quot; border="0" alt="520px Fan"></div></fb:else>
      </fb:visible-to-connection>
      </div>

      • http://www.hyperarts.com timware

        The problem seems to be with the 2 <p> tags, so remove them.

        Also, you have an extra closing DIV — </div> — just before the <fb:else> tag. Delete it.

        • tuba

          Thank you for your reply Tim. I did what you just told me but I still have the same problem, the content for the non-fans is not visible. Entire page look blank if you didn’t like the page. content for fans works fine when you like or unlike the page. I used 2-3 different account to test it.

          • http://www.hyperarts.com timware

            When I took your code above and removed all the <p> tags (there are actually 3 of them), and removed that closing </div> tag before the <fb:else> tag, it worked in my tests.

            Also, you have <href …> right after the <fb:visible-to-connection> … It should be <a href …>

    • http://www.thekitelife.com Gabe

      Hi, I have read thru here a few times but not seeing an issue like I have. Using the following code, it is putting both images on top of each other when a Fan views the tab. Part of the problem may be that I didnt fully understand your info about positioning.

      CSS:

      #wrapper {
      width:520px;
      margin:0 auto; border:0; padding:0;
      position:relative;
      }
      #non-fans {
      width:520px;
      position:absolute; top:0; left:0;
      }

      CODE:
      <link rel="stylesheet" type="text/css" href="https://sites.google.com/site/thekitelifestorage/facebook/fbcode.css?v=10.2&quot; />
      <div id="wrapper">
      <fb:visible-to-connection>
      <style type="text/css">
      <!--
      .style1 {font-size: 9px}
      -->
      </style>
      ......CODE REDUCED FOR THIS FORUM....
      <tr>
      <td valign="top">&nbsp;</td>
      <td valign="top">&nbsp;</td>
      </tr>
      </table>
      </div>
      <fb:else>
      <div id="non-fans"><img src='http://img135.imageshack.us/img135/739/kitesurfsafariholidays.png&#039; border='0'/></a>
      </fb:else>
      </fb:visible-to-connection>
      </div>

      • http://www.hyperarts.com timware

        There may be issues with using “https” for the stylesheet URL.

        The DIV in <fb:else> isn’t closed with </div>.

        You might test this by using the <style> tag to include the CSS (assuming you’re not using IE 8 to view this … it doesn’t like the <style> tag).

        I assume you coded the <table> correctly, as you removed the code for brevity.

    • http://www.circle.org Erik Karff

      Greetings! I am doing the best I can to make this work. So far, with the great advice given in this article, I have been able to get the content i want visible to fans/non fans. What I am struggling with is the CSS that makes it so the non-fan content is not pushed down (I’m a bit of a beginner at this). Where does that CSS go? I may be missing some beginning steps.

      I created the content in photoshop then hosted in photobucket. Basically, I’m not sure where to place the CSS code. My thought is that it is not in the FBML box.

      Any help of guidance is VERY appreciated!

      Sincerely,
      javascript:document.tcommentform.submit();
      Erik

    • http://www.point3media.com Taylor V

      Thank you so much for posting the code! Can’t wait to put this up on a few of our pages.

    • http://www.sexykrompir.com Krompir

      Hey I have a question for you? Can you tell me what is the code for the fan page like this: http://www.facebook.com/pages/EKSKLUZIVNO-GRUPNI-CHAT-ZA-VAS-PROFIL/121531284531421?v=app_4949752878#!/pages/Lik-koji-je-svaki-dan-8-godina-slikao-svoje-lice-pogledaj-video/122826207772482?ref=ts

      on that page you have to click on 3 colors and after that on your wall it will be automatically posted the link of that fan page.

      I really need to know what is the code for that…thanks :)

    • Harish

      How to Bring Non fan Content Up and Fans Content Down .So tat as soon as fans click on like Non fan content should disappear ..I want non fan content on Top

      • Harish

        ?

    • http://perrspective.com Dolma

      This is what im trying to do. Have non fans see a img of a video with something that states they need to become a fan to view video. For fans, i just want the video. To give you a better example, this page is exactly want i want.
      http://www.facebook.com/AvonProductsInc?v=app_153816914639769

      The part for the fans works perfectly however the part for the non fans does not. If i just have text for the non fans part, it works perfectly. However, if i add nothing shows up. Please Help!.

      • http://www.hyperarts.com timware

        If you follow this tutorial closely you should be able to do this. On the Avon page, the non-fan content is one big image, so that’s what goes within the <fb:else> … </fb:else> tags.

        The video that is revealed when the user like the page requires the user to click to load the video, which is how Facebook does it. You can read our tutorial on embedding YouTube videos on Static FBML tabs to help you.

    • http://perrspective.com Dolma

      First of all, thank you sooooo much for the quick response. I figured out what i was doing wrong. However there is one more area which i need help in. I understand that the non fan is one big image, however the big image seems to be a link, which when you click, opens a box that states you need to be a fan. I would like to implement that feature. What code do i need to put to have the pop up box? Please Help.

      • http://www.hyperarts.com timware

        It’d done by adding FBML code to the <a href= …> tag that would be wrapped around the big image. The FBML tag used is <fb:dialog> and you can find out more about it here: http://on.fb.me/d9XCTk. Read and learn.

    • http://fanpagedirect.com Cameron Halstead

      Hi Tim,

      Here is my code:

      <div id="wrapper">
      <fb:visible-to-connection>
      <img src="http://img299.imageshack.us/img299/2959/discounts.jpg&quot; width="520" height="600" border="0" target="_blank" /></a>
      <fb:else>
      <div id="non-fans"><img src="http://img837.imageshack.us/img837/2834/coitwelcome.jpg&quot; width="520" height="600" border="0" target="_blank" /></a></div>
      </fb:else>
      </fb:visible-to-connection>
      </div>

      Here is my page:

      http://on.fb.me/cZQWfE

      How do I affect the height of the non-fan portion to be directly in front of fan content?

      I don’t know what your response here entails…”height value and the “margin-top” negative values for your individual case.”

      Sorry if it seams like a stupid question,

      Thank you for your help!

      Cam

      • http://www.hyperarts.com timware

        Just do it the way I do it in this tutorial (not the old way with negative margins, but the NEW way with absolute positioning. It’ll work.

    • http://perrspective.com dolma

      I thought i posted on here last night. Timware do you know how this page added the like button in the dialog box? i’ve tried a lot of different things and nothing is working. please help. this is the page.
      http://www.facebook.com/AvonProductsInc?v=app_153816914639769

      This is the code i have added in the dialog content portion for the like button.

      window.fbAsyncInit = function() {
      FB.init({appId: ‘your app id’, status: true, cookie: true,
      xfbml: true});
      };
      (function() {
      var e = document.createElement(‘script’); e.async = true;
      e.src = document.location.protocol +
      ‘//connect.facebook.net/en_US/all.js’;
      document.getElementById(‘fb-root’).appendChild(e);
      }());

      PLEASE HELP! any direction would be greatly appreciated. Thank you.

    • http://www.hirekogolf.com Rob Altomonte

      Tim, for some reason I cannot get the non-fan jpeg to pop up for http://www.facebook.com/hirekogolf.com

      The fan image shows up fine though-here’s my code:

      <div id="wrapper">
      <fb:visible-to-connection>
      <a href="http://www.hirekogolf.com/"><img src="http://support.hirekogolf.com/wp-content/uploads/2010/10/facebook_coupon.jpg"><fb:else><div id="non-fans"><img src="http://support.hirekogolf.com/wp-content/uploads/2010/10/click_like.jpg"><div></fb:else></fb:visible-to-connection></div&gt;

      do you know what’s wrong? I thank you SO much.
      Rob Altomonte
      Hirekogolf.com

      • http://www.hyperarts.com timware

        Well, both image URLs are correct. Are you trying to view the page while logged in as an admin? If so, you’ll see both states.

        I also notice you have opening <a href …> tag but not a closing tag. You should fix that.

    • http://perrspective.com Dolma

      Timware, do you know why comment boxes don’t work properly in dialog boxes? The “like” or the comment does not work.


      <fb:dialog id="Code">
      <fb:dialog-title>Click LIKE to see real-life testimonials.
      </fb:dialog-title>
      <fb:dialog-content>

      <fb:comments xid="arbonne_comments" canpost="true" candelete="false" numpost="2" returnurl="http://www.facebook.com/arbonne"&gt;
      <fb:title>Like Us!</fb:title>
      </fb:comments>

      </fb:dialog-content>
      <fb:dialog-button type="button" value="Okay" close_dialog="1"/>
      </fb:dialog>

      • http://www.hyperarts.com timware

        Yes, it doesn’t seem to work, so I guess Facebook doesn’t allow that.

    • sov

      in response to people having a blank page for non-fan on Safari, Firefox, OR IE8, i found a way to shim the code so that it finally worked for me.

      this is what I created, following Tim’s advise to include all styles in my style sheet AND not the use the old way, but to force the absolute positioning.

      I added in line in my fb:else code below:

      <fb:else>

      <div id="non-fans" style="width:520px; position:absolute; top:0; left:0;>

      <br class="clearfloat">

      <img src="some_img1.jpg?v=40.0" id="someimg1" alt="" />
      <br class="clearfloat" />
      <img src="some_img2.jpg?v=40.0" id="someimg2" alt="" />
      <br class="clearfloat" />

      </div>

      </fb:else>

      And also, adding the single Clearfloat (BR) above my images exported out with Fireworks, was the only way it would show up and not cut off the top. It doesn’t make sense, but it worked.

      Also importantly, not evident in the ‘cut and paste’ section of this tutorial to me, I needed to ‘close’ the DIV tag before the closing of (fb:/else)

      And lastly, in one of TIm’s other articles, I fgired out how to get around the FB caching issue.. i added the “?v=40.0″ at the end of not only my external css, but ALL my images.. or else they would be in cache for at least 24-48 hours, making it impossible for me to do browser testing.

      So thats the latest of my research, I hope it helps a few people on this forum as it has me.

      • http://www.hyperarts.com timware

        Thanks for the contribution! I’ve found that the absolute position method works across all browsers and platforms if done correctly, per the instructions in this post.

      • http://www.eeepc.dk/ Christian Brix

        sov, could you post the ENTIRE code that you are using? Including CSS and everything.. I would like to see how you do it.. Thanks!

    • http://www.eeepc.dk/ Christian Brix

      Did you test the new version of hiding the invisible things/space in IE 7 and/or 8?
      Even when copying your code without changing anything but the text (replaced with 2 images in the excat same size) this does not work for me in IE..
      It does work like a charm in other browsers though!

      • http://www.hyperarts.com timware

        Yes, it works fine … IE 7 and 8 AND 6! Here’s my example.

        But for IE you MUST use an external stylesheet using the <link ref=”stylesheet” href=”URL” /> !

    • Carly

      Hey there!

      This is all really great info. Unfortunately, I’m still having problems!

      I want to link my image that is shown to only fans to a website outside Facebook. Every time I put in the code that I think should work, my reveal image disapears altogether. Any ideas on how I can make this work? I would love some code to copy! :)

      Thanks

      Carly

    • AK

      Hi have a different issue, and I can’t find a solution, hope I could use your help.

      I have made my fmbl tab my default tab, but users who are fans of my page see the “wall” as a default tab, and users who are not fans see the default tab.

      How can I make sure that no matter if you click like or don’t fans will remain on my fbml tab and not get redirected to the wall.

      Similar to what the WSJ page: http://www.facebook.com/wsjonline?v=app_4949752878

      Thank you so much in advance!
      John

      • http://www.hyperarts.com timware

        Fans have already clicked Like, so they can only click the “Unlike” link at the bottom of the left-side column on the Wall.

        The default landing tab for Fans will be the Wall and you can’t change that.

    • ryan

      ryan :
      I have tested both like and non like and the proper contents (image) shows up. My question is even though they land on my custom tab and see the call to action graphic they can still click on the other tabs that I am trying to hide until they ‘like’ the site. I am a newb when it comes to code and am pleased I have made it this far but the whole point is that they dont have access until they ‘like’. Suggestions.


      <fb:fbml version="1.1">
      <fb:visible-to-connection>Welcome to the Coastal Fitness Page, check out our latest Fitness and Nutrition tips and for even more head over to <a href="http://www.coastalfitness.ca/
      ">our website</a>

      <fb:else><img src="http://www.coastalfitness.ca/images/likeus.jpg&quot; "width= 520"/></fb:else>
      </fb:visible-to-connection>

      </fb:fbml>

      Sorry for the double post.

      • http://www.hyperarts.com timware

        You can’t hide other tabs from non-fans. You can hide content on a custom tab, but not entire tabs.

    • ryan

      timware :
      You can’t hide other tabs from non-fans. You can hide content on a custom tab, but not entire tabs.

      I suppose it would be possible to have the secondary image/code to have tabs on it that were only visible after the ‘like’ on the same tab, to have hidden content?

      Thanks for your input.

      • http://www.hyperarts.com timware

        Yes, you could have links in the fan-only content to tabs that are under the “>>” tab and not in the top visible tabs.

    • JohnnyDough

      I know it’s possible, but for some reason I can figure out the right way to code it. I’ve followed the code in this tutorial and everything works perfectly.

      Now, what I’d like to do is have mp3s available for people to listen to once they become a fan of the page. I usually use the tag to do this in my other pages, which works. However, I’m not exactly sure how to do this using this tutorial if I want to also use the stylesheet to move the mp3s around on the page.

      Thoughts?

      • http://www.hyperarts.com timware

        Here is the Facebook documentation on using the fb:mp3 tag.

        You should be able to just code these tags after the <fb:visible-to-connection> tag and before the <fb:else> tag.

        If the fb:mp3 tag works when you test it not using the fb:visible-to-connection, then it should work inside those tags.

        Otherwise, I’m not following your question.

        • JohnnyDough

          Ok…let me try to better explain. I understand how to use the tag, but I want to list multiple mp3s. I’m not sure how to set this up properly using the tags. If I take them out, they end up below the image, rather than on top like they normally would. See the code below:

    • JohnnyDough

      I messed up the tags….the mp3 tag is below:
      <fb:mp3></fb:mp3>

    • JohnnyDough

      Ok…let me try to better explain. I understand how to use the <fb:mp3> tag, but I want to list multiple mp3s. I’m not sure how to set this up properly using the <div> tags. If I take them out, they end up below the image, rather than on top like they normally would. See the code below:


      <div id="fans">
      <fb:visible-to-connection><img src="FAN IMAGE"/>

      <div id="mp3-1">
      <fb:mp3 src="MP3 LOCATION" title="SONG TITLE"
      artist="ARTIST NAME" album="ALBUM TITLE" width='X' height='X'/>
      </fb:mp3>

      <fb:else>
      <div id="non-fans"><img src="NON FAN IMAGE"/></div>
      </fb:else>
      </fb:visible-to-connection>
      </div>

      • JohnnyDough

        Actually…I got it to work properly, but now I can’t get the NON-FAN image to show up. ARGH!!!

    • JohnnyDough

      Ok…so the code below works fine, except it’s not loading the NON-FAN IMAGE….thoughts??


      <style>

      #fans {
      width:520px;
      margin:0 auto; border:0; padding:0;
      position:relative;
      }

      #non-fans {
      width:520px;
      position:absolute; top:0; left:0;
      }

      #mp3-1 {
      position: absolute;
      font: 9pt Arial, Helvetica, sans-serif;
      left: 35px;
      top: 240px;
      overflow: no;
      z-index: 2;
      }

      </style>

      <div id="fans"><fb:visible-to-connection><img src="FAN IMAGE"/>

      <div id="mp3-1">
      <fb:mp3 src="MP3 LOCATION" title="SONG TITLE"
      artist="ARTIST NAME" album="ALBUM TITLE" width='X' height='X'/>
      </fb:mp3>

      <fb:else><div id="non-fans"><img src="NON FAN IMAGE"/></fb:else>
      </fb:mp3>
      </fb:visible-to-connection>
      </div>

      • JohnnyDough

        NEVERMIND!! GENIUS RIGHT HERE!! FIGURED IT OUT!! ::Digital Hi-Five::

      • JohnnyDough

        Actually…I do have one question that you can help me with. I need to somehow get my code to work in IE. I’m not exactly sure how to go about doing this…as my code looks great in Safari, Chrome, Firefox.

        • http://www.hyperarts.com timware

          You need to use an external stylesheet for it to work in IE 8. It’ll work for the others, too. Use the <link rel=”stylesheet” href=”URL” /> tag.

          • JohnnyDough

            Ugh…I’m on the hotseat now!! I have done exactly that and now it’s completely messed up in all browsers. If I insert the stylesheet, it stacks everything on the page beneath each other.

            Any help would be greatly appreciated!!

    • http://www.hyperarts.com timware

      JohnnyDough: Provide the code you’re using to call the external stylesheet.

      Make sure you surround the code with the <code> … </code> tags!

      Make sure your stylesheet URL is correct by accessing it directly. You should see it.

      Make sure you didn’t include the <style> …. </style> tags in the .css file.

      • JohnnyDough

        Any way that I can email or private message it?? For one, it’s very very long.

        • http://www.hyperarts.com timware

          Just post the URL to the stylesheet and the code you’re using to link it in your FBML box.

    • JohnnyDough

      Alright…maybe I’ll just shut up now since I figured it out again…haha!! Great great great tutorial though…couldn’t have done it without it!! I’ll definitely be back!!

    • Tammy

      Hi Tim,

      I am using the below code. The fan content appears correctly, but I am not seeing anything when viewing as a non-fan. Can you help me out? Thanks!


      <style type='text/css'>
      #wrapper {
      width:520px;
      height:258px;
      margin:0 auto; border:0; padding:0;
      position:relative;
      }
      #not-fans {
      width:520px;
      position:absolute; top:0; left:0;
      height:258px;
      }
      </style>
      <div id="wrapper">
      <fb:visible-to-connection>
      <div style='width:520px;'>
      <a href="http://www.dhccare.com/DHC/SkinCareInfo/customer_spotlight/LauraHillSooy.aspx"><img src="http://img.dhccare.com/facebook/Offercspot10.01.jpg&quot; /></a>
      </div>
      <fb:else>
      <img src=”http://img.dhccare.com/facebook/Offercspot08.01.jpg” id='not-fans' />
      </fb:else>
      </fb:visible-to-connection>
      </div>

      • http://www.hyperarts.com timware

        Tammy, I suspect you’re an admin of the page you’re testing. If so, then your non-fan content is probably covering your fan-only content. View the page while logged in as a different user or have a friend do so.

    • Tammy

      Hi Tim,

      I’ve viewed the page when not logged in at all and from a non-admin account and no content shows in both situations. Do you think it could be something else? Thanks!

      • http://www.hyperarts.com timware

        The problem, a common one, is that your fb:else URL for the image has curly/fancy quotes around it and this will always break the code. Make those quotes straight up and down and all will be well.

    • S.Mack

      Hello there! I got the code to work but im still getting the white space above the non fan page I can’t get it to be removed. Also my goal is to have all of the fan page tabs hidden until the user likes the page and I don’t know how to enter them as “non-fan content”

      <div id="wrapper">
      <fb:visible-to-connection>
      <img src="http://i289.photobucket.com/albums/ll219/makeupbysaj/open.jpg&quot; /></a>
      <fb:else>

      <div id="non-fans"><a href="http://www.facebook.com/MakeupbySAJ/"&gt;

      <img src="http://i289.photobucket.com/albums/ll219/makeupbysaj/hiddencontent.jpg&quot; /></a</div>
      </fb:else>
      </fb:visible-to-connection>
      </div>
      </fb:fbml>

      • http://www.hyperarts.com timware

        Did you add the styles, as specified in this post? Your code is fine, although the difference between the fans image and the non-fans image is, to say the least, VERY subtle. And lose the </fb:fbml> tag at the end, and the opening tag — <fb:fbml> if you have that but didn’t paste it in your comment.

    • S.Mack

      Thank you so much! I did try it ( i tried the paragraph tags first ) when i first tried it i forgot to put <styles i corrected it and now the images are working perfectly.

      can you advise me on how to go about adding the different tabs to be completely hidden until the user likes the page?
      e.g the wall tab, photos, and video

      • http://www.hyperarts.com timware

        No, you can’t hide entire tabs from non-fans, just content within tabs.

        • S.Mack

          ohhh how do i select the content to be hidden?

          • S.Mack

            never mind i figured it out :) thats why i made my non fan content and fan content similar, i was given the impression that you could hide basically everything except that landing tab, then when u like it everything is available.

            thank you so much :)

    • Pingback: Comprehensive Static FBML Guide – Adding, Testing & Troubleshooting | HyperArts

    • http://www.club6400.com Les

      This is awesome! I used it on my Page and instead of text for the non-fan part, I used a faded out graphic of what the fan part shows.

      Check it out and let me know what you think!
      http://www.facebook.com/club6400dotcom

      Or… just search “Club 6400″ on Facebook. Thanks Tim!

      P.S. – I made the non-fan graphic smaller so that I could still access the fan part of the app (just for me that is since I’m the admin. It doesn’t matter for others)

      • http://www.hyperarts.com timware

        Nice graphic, Les!

    • jan

      Okay, I’m back. I got the code to work, I thought, without the wrapper. However, we posted it and sent out an eblast and got a few people claiming they cannot see the offer. I’m not sure which one they cannot see. I’m suspecting the non-fan. I tested on the mac in Safari and Firefox. I did not test the PC or IE. Here is the code that worked for me. Do I need to do the CSS?

      <div style="height:867px;">
      <fb:visible-to-connection>
      <a href="http://swoozies.com/"><img src="http://i236.photobucket.com/albums/ff153/swoozies/facebookgraphics_oldfans.jpg"/></a&gt;

      <fb:else>
      <p style="margin-top:-867px;">
      <img src="http://i236.photobucket.com/albums/ff153/swoozies/facebookgraphics_NEWFANSgraphic.jpg"/&gt;
      </p>
      </fb:else>
      </fb:visible-to-connection>
      </div>

      • http://www.hyperarts.com timware

        Jan, I can’t do your browser testing for you, but I’d say to never do an email blast without doing cross-browser & Mac/Win checking. The code looks like it should work.

    • Pingback: Facebook Fan Pages – Fan Only Content – FBML