I had this code and it didn't work (only for fans) in Chrome either. For non fans it displayed the image correctly.
I just changed my redirects to a HTTPS and it has worked! :) It looks like Chrome has issues with redirects to http. Just add an "s" to all of your links and it should work.
Be aware of hidden redirects, if you have a parameter URL or something like that, there you need to add the "s" twice: at the beginning (https://www.myweb.com/r.php?
) and in the middle (&url=https%3A//www.myweb.es
)
hope it helps!
An example:
<?php
require 'facebook.php';
$app_id = "384609344916003";
$app_secret = "f615dfb4c787d05d5f1a2fbefd11cadc";
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$signed_request = $facebook->getSignedRequest();
$page_id = $signed_request["page"]["id"];
$page_admin = $signed_request["page"]["admin"];
$like_status = $signed_request["page"]["liked"];
$country = $signed_request["user"]["country"];
$locale = $signed_request["user"]["locale"];
if ($like_status) {
if ($page_id == '1234567890'){
// UK
header("HTTP/1.1 301 Moved Permanently");
header("Location: https://www.myweb.com/fbpromo/");
exit();
}
}
else {
echo "<link type='text/css' rel='stylesheet' href='facebook_new.css'/>";
echo "<body>";
if ($page_id == '1234567890'){
//English
echo "<img src='http://www.myweb.com/img/facebook/FB-app-non-fans.jpg' alt='Like us' /> ";
}
}
echo "</body>";
?>