开发者

how to get the title of a NSURl link without UIWebView

开发者 https://www.devze.com 2023-03-15 06:18 出处:网络
Is it possible to g开发者_StackOverflow社区et the title of a NSURL link without UIWebView ? Thanks.You can load the content which the URL points to and parse the HTML for the title element, but that w

Is it possible to g开发者_StackOverflow社区et the title of a NSURL link without UIWebView ? Thanks.


You can load the content which the URL points to and parse the HTML for the title element, but that won't account for changes to the title as a result of javascript execution. So the answer is 'no', there isn't any way to reliably get the title of a page which is at a given URL.


You can use stringWithContentsOfURL:encoding:error: to get the content of the link and then parse it using NSXMLParser to get the title.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号