A couple of days ago someone asked me whether the old “avoid iframes” mantra was still relevant, and if so why. The specifics of my response may make it into another post, but in summary I suggested that if both sides (host page and iframe target) trust each other, and are working towards a common aim – i.e. they both want the solution to work - then iframes work just fine. I gave the Facebook Social Plugins as my reference for this – the Like button can be implemented as either XFBML or an iframe, and works just fine as either**.
His response (and he may have misquoted his source) was to the effect that he’d been told that that was not the case, and that the Open Graph Protocol didn’t use iframes. I could have let it lie at that, but I trust him, so am happy to lay the blame at the door of his source, in which case some serious explaining is in order.
The Open Graph Protocol is precisely that – a protocol. It is a recommended set of HTML <meta> tag attributes that can be used to give semantic meaning to a web page. There is a healthy OGP group running here - http://groups.google.com/group/open-graph-protocol/topics?pli=1 – where members are discussing possible extensions to the current protocol, but in essence it’s a bunch of machine-readable information that can be used to categorise the contents of a web page. These tags can be used by anyone, either to ‘decorate’ their own website, or to give meaning web pages that include the tags (if you run a service that involves managing URLs – e.g. link shortening, search engines etc.) Facebook’s own use of the OGP tags is pretty basic at the moment – if you “Like” a page, Facebook does two things:
- It registers the fact that you Like it, and posts to your stream
- It retrieves the page itself, and extracts information that is relevant in order to make the Like information more structured.
In a standard web page all Facebook can do is extract the few standard HTML details (page URL, title tag etc.) By encouraging web developers to include the OGP tags they can provide a much richer experience on the Facebook site – they can “know” that when you Like a movie on IMDB that you are talking about a movie, and not some abstract page on the internet. This is the essence of the Semantic Web.
So, to say that the OGP doesn’t support iframes is a bit like saying a boiled egg can’t drive a car. It’s meaningless.