title: Check if user liked page or not
body: <p>I have read a lot of related topics here regarding this problem but I am still not able to do something like this</p>
  
  <p><a href="http://www.facebook.com/Dominos/app_252492331452398" rel="nofollow">http://www.facebook.com/Dominos/app_252492331452398</a></p>
  
  <p>Below is the code i am using</p>
  
  <p>here are my questions.</p>
  
  <ul>
  <li>So I am already logged in into my facebook page</li>
  <li>If I go to the above dominos url, i can like or unlike the page. The dominos content changes based on whether I have liked or unlike the page. But they are not asking we to log in again</li>
  <li><p>In my code below although I already logged in my facebook. i don't get access to my userinfo until I click login button and login in again in the provided popup. how can I skip this step as the dominos is doing. I am getting response.status as not_authorized</p>
  
  <ul>
  <li>I know once I log in, I can do something like to check whether the user has liked my page or not</li>
  </ul>
  
  <p>var query = FB.Data.query( 'select page_id from page_fan where uid='+response.authResponse.userID+' and page_id ='+PAGE_ID);</p></li>
  </ul>
  
  <p>Here is the code</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;Fbjquery&lt;/title&gt;
    &lt;%= stylesheet_link_tag    "application", :media =&gt; "all" %&gt;
    &lt;%= javascript_include_tag "application" %&gt;
    &lt;%= csrf_meta_tags %&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="fb-root"&gt;&lt;/div&gt;
  &lt;h2&gt;Updated JS SDK example&lt;/h2&gt;&lt;br /&gt;
  &lt;div id="user-info"&gt;&lt;/div&gt;
  &lt;p&gt;&lt;button id="fb-auth"&gt;Login&lt;/button&gt;&lt;/p&gt;
  
  
  &lt;script&gt;
  window.fbAsyncInit = function() {
    FB.init({ appId: 'App_ID', 
          status: true, 
          cookie: true,
          xfbml: true,
          oauth: true});
  
    function updateButton(response) {
      var button = document.getElementById('fb-auth');
          console.log("inside update button "+response.authResponse);
      if (response.authResponse) {
          console.log(response.authResponse);
        //user is already logged in and connected
        var userInfo = document.getElementById('user-info');
        FB.api('/me', function(response) {
          userInfo.innerHTML = '&lt;img src="https://graph.facebook.com/' 
        + response.id + '/picture"&gt;' + response.name;
          button.innerHTML = 'Logout';
        });
        button.onclick = function() {
          FB.logout(function(response) {
            var userInfo = document.getElementById('user-info');
            userInfo.innerHTML="";
      });
        };
      } else {
        //user is not connected to your app or logged out
        button.innerHTML = 'Login';
        button.onclick = function() {
          FB.login(function(response) {
        if (response.authResponse) {
              FB.api('/me', function(response) {
            var userInfo = document.getElementById('user-info');
            userInfo.innerHTML = 
                  '&lt;img src="https://graph.facebook.com/' 
              + response.id + '/picture" style="margin-right:5px"/&gt;' 
              + response.name;
          });    
            } else {
              //user cancelled login or did not grant authorization
            }
          }, {scope:'email'});    
        }
      }
    }
  
    // run once with current status and whenever the status changes
  
    FB.getLoginStatus(updateButton);
    FB.Event.subscribe('auth.statusChange', updateButton);    
  
  
  };
  
  (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);
  }());
  
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>