Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Open Graph extensions for email
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
example
.gitignore
Readme.md

Readme.md

Open Graph Protocol email extensions

Parsing out the OGP email actions

We recommend using the OGP jQuery plugin.

Then load the plugin along with jQuery and the below javascript to parse the OGP tags out. Simple.

// parses the HTML

var data = $('html').ogp(); 

// get the URLs
var actions = data['email:action']; 
var web_urls = data['email:action:web_url'];
var apps = data['email:action:iosapp_url'];

// creates JSON string
var z = '['; 

function def(x) { 
    if (x) return x; 
    return ''; 
} 

for (var i = 0; i < actions.length; i++) { 

    if (i > 0) { 
      z = z + ','; 
    } 
    z = z + '{ "name" : "' + def(actions[i]) + '", '; 
    if (apps) {
        z = z + '"app" : [ "' + def(apps[i]) + '" ], '; 
    }
    if (web_urls) {
        z = z + '"url" : "' + def(web_urls[i]) + '" '; 
    }    
    z = z + '}'; 
} 

// returns back to calling UIWebView
z = z + ']'; 
Something went wrong with that request. Please try again.