Question:

I have updated my css file on the web server, but still the old styles are used in the application on Facebook. What's wrong? And how should I force Facebook to pick up the updated styles?

 

 

 

Answer:

Appreciate if you can like this page if you find it useful! - Click "Like"

If you encounter this problem and want to make sure the latest styles are used in displaying the application on Facebook, the following trick may be useful to you:

  • While specifying the css file in your web pages, add a query string parameter to the href attribute.

    <link type="text/css" rel="stylesheet" href="http://blablabla.bla/style.css?1" /

  • Every time you update the css file, change the query string parameter.

 

The above trick can also be done in an automatic way. For example, if you are writing PHP scripts, the following code can be used:

$cssfile='mystyle.css';
$timestamp=filemtime($cssfile);
echo "<link type='text/css' rel='stylesheet' href='PATH_TO_CSS/$cssfile?$timestamp'/>\n";

 

 

Find my FAQ on Facebook Development useful? Download the PDF for all the FAQs HERE!