Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Open Graph Protocol parser in jQuery
JavaScript Ruby
Latest commit b9ef120 @fiann Add BSD license


Open Graph Protocol parser

This is a simple parser for Open Graph Protocol data, implemented as a jQuery plugin.

The parser converts OGP data into a JSON object, in the same format as the server-side OGP to JSON parser. You can then use the data from jQuery without redeclaring the content in your page.


First, create a page with some OGP meta elements. Here's the canonical example:

<html xmlns:og="">
<title>The Rock (1996)</title>
<meta property="og:title" content="The Rock" />
<meta property="og:type" content="movie" />
<meta property="og:url" content="" />
<meta property="og:image" content="" />

Then load the jQuery library (tested with jQuery 1.4.2) and the jquery.ogp.js.

jsondata = jQuery('head').ogp();


There are some test pages in the test folder. You can fire up a simple webserver (Sinatra) by typing

rake server

and then open http://localhost:4567/.

There's also some basic test automation using the wonderful Ruby wrapper for env.js. Type

rake test

to run all the tests in a simulated browser environment.


This code is licensed under the BSD license. There's just a stub at the moment, but help yourself if it's useful to you.

Something went wrong with that request. Please try again.