Skip to content

krishna23456/open-graph-protocol

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

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 + ']'; 

About

Open Graph extensions for email

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published