title: Javascript for Facebook Like
body: <p>I am trying to add a facebook like button. I am using the standard XFBML code generated from developers.facebook.com. However, here's the problem: Say my use case is that mail will be sent to customers which will have a link to like my site. Now since you cannot include javascript in emails I have to redirect the user to an intermediate page, which hosts the like button. When the user clicks it he will be either asked to login or will be asked to like it. </p>
  
  <p>I am looking for a way to automatically click the like button when the user clicks on the link from his email. So basically auto-liking the page when he clicks from his email, so that he does not have to click twice - (once on the email link and once on the like button on the intermediate page).The code that I am using is: </p>
  
  <pre><code>&lt;div id="fb-root"&gt;&lt;/div&gt;
  
  &lt;script&gt;
  
  function f1(d, s, id) {
    alert('Function Called');
    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_US/all.js#xfbml=1&amp;appId=171216266453";
    fjs.parentNode.insertBefore(js, fjs);
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onLoad="f1(document, 'script', 'facebook-jssdk')"&gt;
  
  &lt;div class="fb-like" data-href="http://www.google.com/" data-send="false" data-width="450" data-show-faces="true"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>