javascript - Parsing Open Graph meta properties/tags in ObjectiveC -


i have ios app in objectivec uses uiwebview load webpage. want parse open graph meta tags of web page -

<meta property="og:locale" content="en_us" /> <meta property="og:title" content="my title" /> <meta property="og:site_name" content="my content" /> 

with following code can iterate through of meta tags , content, how check meta properties interested in?

nsstring *resultstr = [self.viewweb stringbyevaluatingjavascriptfromstring:                       @"(function(){"                        "var i, metafields = document.getelementsbytagname(\"meta\"), result = [];"                        "for (i = 0; i< metafields.length; i++) {"                                 "result.push({\"content\": metafields[i].content});"                        "}"                        "return json.stringify(result);"                        "})();"                        ]; nsarray *result = [nsjsonserialization jsonobjectwithdata:[resultstr datausingencoding:nsutf8stringencoding] options:0 error:nil]; nslog(@"result: %@", result); 

for example if interested in "og:site_name" how check it? tried "metafields[i].property" seems properties not accessible ways. want -

"if (metafields[i].property === \"og:site_name\")" 

thanks,

have tried using getattribute dom method on element? like:

metafields[i].getattribute('property') 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -