I am using the FB Javascript SDK in a website and it seems that the channel.php file is forcing my content to not refresh. In the channel.php file I have the following:
<?php
$cache_expire = 60*60*24*365;
header("Pragma: public");
header("Cache-Control: maxage=".$cache_expire);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$cache_expire) . ' GMT');
?>
<script type="text/javascript" src="//connect.facebook.net/en_US/all.js"></script>
Each page of the website which requires use of the SDK has the following included directly beneath the opening tag:
<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $cfg['fb_app_id']; ?>',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
channelUrl : '<?php echo $cfg['http_prefix'].$cfg['domain_name'].'/'; ?>channel.php', // Custom Channel URL
oauth : true //enables OAuth 2.0
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#appId=<?php echo $cfg['fb_app_id']; ?>&xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
It seems that pages which call this file "stale" in the browser cache. I was out of the office for a day and once returned the pages were still containing their old content until I did a shift-click reload on the pages. Any thoughts?