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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -