Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is how I did it for The Office Quotes application:</p> <ol> <li>Put the random quote inside an image (many options to do this in PHP, I used the GD and Image Functions at <a href="http://us2.php.net/manual/en/ref.image.php" rel="nofollow noreferrer">http://us2.php.net/manual/en/ref.image.php</a> to create a JPG containing the quote).</li> <li>Accessing this dynamic image in a browser gives you a different random quote each time you refresh.</li> <li>On the Facebook profile box or tab, simply link this image.</li> <li>However, Facebook caches the image the first time it's loaded, so it never updates!</li> <li>To force Facebook to update, you must <strong>update Facebook's image cache</strong> for the image's URL using the API function <code>fbml.refreshImgSrc</code> which is now accessed via the URL <a href="http://api.facebook.com/methods/fbml.refreshImgSrc" rel="nofollow noreferrer">http://api.facebook.com/methods/fbml.refreshImgSrc</a> and requires the access_token parameter like all other API requests. <em>There was an announcement some time ago that this function was being deprecated, but the decision was reversed!</em></li> <li>Setup the cache refresh code to run regularly. You can do this on a scheduled task (i.e. a cron job) or on each pageview in the application, or any other way you can think of that will cause the method to be run with the relative frequency the image will be requested by a user.</li> <li>I also linked the image in the profile to a page in the app that would continually reload a new random image. Users generally would click to this page (which would refresh the image cache on each load) and they get the illusion that the image updates constantly.</li> <li>Another illusion that I like even better is to add a 'Refresh' link in the profile box/tab that links to a script that refreshes the image cache and immediately returns to the user's profile, so that it actually appears to just be refreshing the profile box/tab.</li> </ol> <p>Enjoy!</p>
 

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