Sharing a link. It sounds so fucking easy, doesn’t it?
I’ve been dicking with this for over a year now. If you try and fight me on this, I will end you.
Adding the Share code to your page causes Facebook to prematurely hit your page and cache it even if nobody ever actually clicks share.
Why is this a problem?
Because when a profile is created it has no images. My og:image tag is telling to use the sites logo, but of course Facebook ignores this shit and instead pulls a random image from the web page, usually the QR Code, which is not even visible by default. This is fine, whatever, nobody has even shared that page yet anyway because its brand new.
Oh wait, but, just the act of loading the share button causes Facebook to cache it. Now when the user uploads their own images to the profile header and icon, the share dialog is still using the old cached copy instead of with the new images. This means the first time they actually try and share their nice and completed profile, Facebook is all like “here is the shitty looking one from 4 hours ago”
[Fail] Call the Graph API to tell them to scrape your shit when someone changes something on the profile. It works, they hit your shit. It almost never actually updates the cache though – at least not nearly instant enough to make it work right. I can confirm every time the user changes their images now Facebook is hitting the page with
curl "https://graph.facebook.com" -d "scrape=1&id=URLENCODEDURL"
tail -f access.log .. and the JSON it returns even says “HEY I FOUND YOUR UPDATED OG:IMAGE” – except here we are, still seeing stale cache in both the share dialog and the final feed post if we decide to be bold and click share anyway.
[Fail] Use version’d URLs. I now have pending=RANDOMNUMBERRRRR on the front of any profile which does not yet have images. It doesn’t work, Facebook seems to be ignoring the query component. There are lots of suggestions of using fbrefresh=rando too, but that is also defunct.
[Fail] Use the FB.UI (from the JS SDK) manually instead of their prefab share code. This calls a newer version of the popup than Facebook’s Share Button generator which seems to be better about showing the latest cache. This button refuses to work except on the domain your app is configured for. It will toss a giant red error to the user.
Ok, that is fine, Facebook allows you to set multiple domains in the App control panel. WRONG. IF YOU TRY, THEY TELL YOU TO FUCK OFF BECAUSE THE DOMAIN MUST MATCH THE CANVAS URL, WHICH NOBODY FUCKING USES FOR SHARING EITHER.
[Fail] Do not include the Facebook JS SDK and Share button until the profile has images. This fails because now my users think they can’t share their page ever because they can’t see the share button from step one. Users need to see all their shit from the moment they open the account or they think it is broken.
[Fail] Wait 24 hours. Screw you.
It actually gets a little worse.
When using the prefab Facebook share button, it uses an older version of the share popup, and this popup seems to have its own cache which is separate from the Graph API cache. This means it is possible to click share, see the QR code, be unable to change it, hit share, and then some totally different image… sometimes random, sometimes og:image, is actually what is displayed on the Facebook feed.