Facebook like to see content

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Facebook like to see content

    I would like to add this on one page...

    So when visitor opens that page on a site first to be asked to like Facebook page and than he will see the content, if logged in Facebook. And if not, to be asked to loggin and click like button.

    Any idea how to do this?
    <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

    #2
    has to be done with facebook api i guess
    Advertise your mobile site for FREE with AdTwirl

    Comment


      #3
      1. Include the JavaScript SDK on your page once, ideally right after the opening <body> tag.
      You can get an app ID here https://developers.facebook.com/​
      HTML Code:
      <div id="fb-root"></div>
      <script>(function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.5&appId=APP ID";
        fjs.parentNode.insertBefore(js, fjs);
      }(document, 'script', 'facebook-jssdk'));</script>

      2. Add a like button code to your page
      HTML Code:
      <div class="fb-like" data-href="http://coding-talk.com/" data-layout="button_count" data-action="like" data-show-faces="true" data-share="false"></div>
      3. Create a like callback function
      HTML Code:
      <script type="text/javascript">
      var page_like = function(url, html_element) {
        alert(url+' Liked!');
      //here you can do something like $('#hiddencontent').show();
      }
      // In your onload handler
      FB.Event.subscribe('edge.create', page_like);
      </script>
      Last edited by kevk3v; 24.10.15, 14:28.
      Mobile chat, iphone chat, android chat, chat, rooms http://www.aiochat.com

      Comment


        #4
        I guess so too, its a bit confusing docs there...

        Thanks Kev. If it comes into play i'll check this out.
        <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

        Comment


          #5
          A little more help:

          Using: $('#hiddencontent').show();
          Content you wish to stay hidden would have to be in id="hiddencontent" with css: #hiddencontent{ display: none; }

          eg:
          HTML Code:
          <div id="hiddencontent" style="display: none;">
          Content you dont want seen here
          </div>
          Last edited by something else; 25.10.15, 19:56.

          Comment


            #6
            Ok, thanks.
            Sorry for late answer.
            <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

            Comment

            Working...
            X