title: Trigger a Facebook like button when the page loads
body: <p>I want to trigger a Facebook like button as soon as the page loads.</p>
  
  <p>This is the script required to use a Facebook like button:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;script src="http://connect.facebook.net/en_US/all.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    FB.init({
      status : true, // check login status
      cookie : true, // enable cookies to allow the server to access the session
      xfbml  : true  // parse XFBML
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>The Facebook like button:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;fb:like href="http://ecommercedeveloper.com" layout="standard" show_faces="true" width="400" action="like" font="segoe ui" colorscheme="light" id="facebook" /&gt;
  </code></pre>
  
  <p>My script, at the bottom of the page:</p>
  
  <pre><code>&lt;script&gt;
    (function($){
      $('fb:like').trigger('click');
    })(jQuery);
  &lt;/script&gt;
  </code></pre>
  
  <p>Unfortunately, when the script runs the like button doesn't seem to be pressed. Is there any way to trigger the like button non-manually?</p>