Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The first URL gives a HTTP 302 (temporary redirect) to the second. So, to find the second URL programatically, you could issue a HTTP request for the first URL and get the <code>Location</code> header of the response.</p> <p>That said, don't rely on the second URL being pemanent. Reading a little in to the HTTP response code (of 302 as opposed to a permanent 301), it is possible Facebook changes those URLs on a regular basis to prevent people from&mdash;for example&mdash;using their servers to host images.</p> <hr> <p><strong>Edit:</strong> Notice that the CDN URL the OP posted is now a 404, so we know that we cannot rely on the URL being long-lived. Also, if you're linking to the Graph API from an <code>&lt;img&gt;</code> on a SSL-secured page, <s><a href="https://stackoverflow.com/a/9219460/201952">there's a parameter</a> you have to add</s> make sure you use <code>http<b>s</b>://graph.facebook.com</code>.</p> <hr> <p><strong>Update:</strong> The API has <a href="https://developers.facebook.com/docs/reference/api/using-pictures/" rel="nofollow noreferrer">added a parameter</a> &ndash; <code>redirect=false</code> &ndash; which causes JSON to be returned rather than a redirect. The retruned JSON includes the CDN URL:</p> <pre><code>{ "data": { "url": "http://profile.ak.fbcdn.net/...", "is_silhouette": false } } </code></pre> <p>Again, I wouldn't rely on this CDN URL being long-lived. The JSON response is sent with permissive CORS headers, so you're free to do this client-side with XHR requests.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload