title: Facebook API Error 100 - invalid link
body: <p>I am using the Facebook API to create a Send Dialog in my Rails App. I just use the format that Facebook recommends in a Javascript (as a script in HTML).</p>
  
  <p>My problem is that I get an:</p>
  
  <pre><code> API Error code 100, invalid parameter, link URL not properly formatted
  </code></pre>
  
  <p>on the following: </p>
  
  <pre><code> &lt;script&gt;
  
      function detail(friend_id, user_name, restaurant_name, restaurant_id, articles){
        // assume we are already logged in
        FB.init({appId: '&lt;%= Facebook::APP_ID.to_s %&gt;', xfbml: true, cookie: true});
  
        FB.ui({
          to: friend_id,
            method: 'send',
            name: user_name +' needs more details about '+ restaurant_name,
             picture: 'http://fb-logo-75.png',
            link: "&lt;%= Facebook::SITE_URL%&gt;restaurants/"+restaurant_id,
            description: '&lt;b&gt;'+user_name + ' needs your help.&lt;/b&gt; Add some color to your review of &lt;b&gt;'+restaurant_name+'&lt;/b&gt; and help '+articles["object"]+' decide if he should eat there.'
            });
      }
       &lt;/script&gt;
  </code></pre>
  
  <p>Please note that:</p>
  
  <p>a) The Facebook::SITE_URL changes depending on the environment. You may think this is a localhost problem. However when I integrate the value of the website URL (which is a valid website, unlike localhost) I still get an error. Yet that link (to my app on Heroku
  ) is definitely functioning.</p>
  
  <p>b) When I post to feed, whether from localhost or in production, I don't get an error. The problem seems confined to the Send Dialog.</p>
  
  <p>c) when I put in another URL such as <a href="http://www.cnn.com" rel="nofollow">http://www.cnn.com</a> I don't get an error.
  Here is how the method is called on the page:</p>
  
  <pre><code>    &lt;li class = "flat_list_item"&gt;&lt;button id="detail_friend" onclick='detail(&lt;%= review.user.fb_id.to_s %&gt;, "&lt;%= @current_user.first_name.to_s %&gt;",
  "&lt;%= review.restaurant.name.to_s %&gt;", &lt;%= review.restaurant.id %&gt;,&lt;%= @current_user.gender_article.to_json %&gt;)'&gt;Tell me more&lt;/button&gt;&lt;/li&gt;
  </code></pre>
  
  <p>NOTE: User.gender_article is a hack that provides "his/him/he if the user is male, "her/her/hers if the user is female.</p>
  
  <p>This is how this translates on the client side: </p>
  
  <p>The HTML:</p>
  
  <pre><code>&lt;button id="detail_friend" onclick="detail(XXXX, &amp;quot;Laurent&amp;quot;,&amp;quot;Refuge&amp;quot;, 227,{&amp;quot;subject&amp;quot;:&amp;quot;he&amp;quot;,&amp;quot;possess&amp;quot;:&amp;quot;his&amp;quot;,&amp;quot;object&amp;quot;:&amp;quot;him&amp;quot;})"&gt;Tell me more&lt;/button&gt;
  </code></pre>
  
  <p>And this is  what the script looks like on the client side:</p>
  
  <pre><code>function detail(friend_id, user_name, restaurant_name, restaurant_id, articles){
    // assume we are already logged in
    FB.init({appId: 'XXXX', xfbml: true, cookie: true});
  
    FB.ui({
      to: friend_id,
        method: 'send',
        name: user_name +' needs more details about '+ restaurant_name,
         picture: 'http://fb-logo-75.png',
        link: 'http://powerful-woodland-3700.herokuapp.com',
        description: '&lt;b&gt;'+user_name + ' needs your help.&lt;/b&gt; Add some color to your review of &lt;b&gt;'+restaurant_name+'&lt;/b&gt; and help '+articles["object"]+' decide if he should eat there.'
        });
  }
  </code></pre>
  
  <p>Note that this link actually is a functional link (albeit with a lot of bugs - but it exists and links to an actual website)</p>