Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Thursday, May 16, 2013

The Facebook Like Bug

I'll be honest - there are certain kinds of debugging that stress me out - such as when the bug is intermittent. One example is a bug that I've been looking at for the past day and a half: for quite a while, our users have been finding that Facebook Like buttons aren't working on their sites. They click Like and the popup appears for a second before disappearing. And it doesn't happen all of the time.

Well, we finally carved out some time this week to take a look at the issue. And yes, I could reproduce it yesterday. So I did my tried and true method of "deconstruction", in which I keep taking things away from the page until the problem stops. Well, I whittled the page down to just the Facebook Like snippet and it was still happening. So it was something to do with the URL we were giving to the Like button.

And then I couldn't reproduce it anymore.

Anyway, I was able to reproduce it again today. I put a bunch of Like buttons on a page: some that worked, some that didn't. And I eventually got it so that the only difference was that the Like buttons that didn't work had URLs that redirected to another URL.

By the way, throughout this saga, I was trawling the Facebook Bug Database and Stack Overflow for a silver bullet - someone who fixed the problem and here are the steps. I couldn't find any silver bullet, but it was still valuable because I heard mention of the Facebook Debugger, which sometimes fixes things when you put a URL through it because it clears Facebook's cache.

I tried putting my URL into Facebook's Debugger but it didn't fix my Like button. But I took a second look at the debugger results, and 'lo, there were some warnings about missing OpenGraph tags. I browsed around a bit and found that three of those tags are required (og:type, og:url, and og:title). So I put those tags on my page and...

yes...

the problem was fixed! Yay!

0 Comments:

Post a Comment

<< Home