title: Facebook Share dialog doesn't work when href parameter is a variable
body: <p>I'm trying to share a link on Facebook from within my web app. I already have the SDK initialized, etc., and the following code works fine:</p>
  
  <pre><code>callToMyAPI()
      .then(function(response) {
          FB.ui({
              method: "share",
              href: "http://www.google.com",
          }, function(response) {
              console.log(response);
          });
      });
  </code></pre>
  
  <p>This pops open a Facebook Share dialog, with a link to <a href="http://www.google.com" rel="nofollow">http://www.google.com</a> and a little embedded preview (the box at the bottom that shows an image from the URL, plus a title and description/excerpt from the page). When I click the "Post to Facebook" button in the dialog, then switch over to Facebook, I see the post with the shared link.</p>
  
  <p>But I need to set the <code>href</code> parameter dynamically, using a value that comes back from my API. So I did this instead:</p>
  
  <pre><code>callToMyAPI()
      .then(function(response) {
          var url = response; // http://www.google.com
  
          FB.ui({
              method: "share",
              href: url,
          }, function(response) {
              console.log(response);
          });
      });
  </code></pre>
  
  <p>Basically, all I'm doing is replacing the hardcoded <code>"http://www.google.com"</code> with the variable <code>url</code> (whose value is the response, which is <code>http://www.google.com</code>). Everything else is exactly the same. But when I do this, here's what happens: </p>
  
  <ol>
  <li><p>The Facebook Share dialog still opens, but it's missing the embedded preview of the URL I'm trying to share</p></li>
  <li><p>When I click the "Post to Facebook" button, the dialog closes, but nothing is ever posted to Facebook. And the response that's logged is just an empty array (<code>[]</code>)</p></li>
  </ol>
  
  <p>So it's choking on using the response from my API as the <code>href</code> value, but I don't understand why. How do I fix this?</p>
  
  <hr>
  
  <p><strong>Update</strong>: after much trial and error, I discovered this bizarre behavior...</p>
  
  <p>If I use <code>http://dev.example.com</code> as the <code>href</code> value (where example.com is actually my real domain), I don't get a preview in the Share dialog and nothing is posted to Facebook:</p>
  
  <pre><code>FB.ui({
      method: "share",
      href: "http://dev.example.com"
  });
  </code></pre>
  
  <p>But if I use <code>http://www.example.com</code> (note the <code>www</code>) as the <code>href</code> value (again, where example.com is actually my real domain), I still don't get a preview in the Share dialog, but the post <em>does</em> go through:</p>
  
  <pre><code>FB.ui({
      method: "share",
      href: "http://www.example.com"
  });
  </code></pre>
  
  <p>However, since there was still no preview in the Share dialog, it doesn't actually attach the link to the message. So on Facebook, all I get is a post with whatever comment I wrote, but no embedded link to <code>http://www.example.com</code>.</p>