How to Get the Title of a HTML Page Displayed in UIWebView?

For those who just scroll down to find the answer:

- (void)webViewDidFinishLoad:(UIWebView *)webView{
    NSString *theTitle=[webView stringByEvaluatingJavaScriptFromString:@"document.title"];
}

This will always work as there is no way to turn off Javascript in UIWebView.


WKWebView has 'title' property, just do it like this,

func webView(_ wv: WKWebView, didFinish navigation: WKNavigation!) {
    title = wv.title
}

I don't think UIWebView is suitable right now.