iOS-获取webview的 url 和 title 和 html

@property (strong,nonatomic)UIWebView *webView;
@property (strong,nonatomic)NSString *currentURL;
@property (strong,nonatomic)NSString *currentTitle;
@property (strong,nonatomic)NSString *currentHTML;
---------------------------------

-(void) webViewDidFinishLoad:(UIWebView *)webView {
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
//获取当前页面的title
self.title = [webViewstringByEvaluatingJavaScriptFromString:@”document.title”];

self.currentURL = webView.request.URL.absoluteString;

NSString *ns = @”document.documentElement.innerHTML”;//获取当前网页的html
self.currentHTML = [webView stringByEvaluatingJavaScriptFromString:ns];
}

你可能感兴趣的:(IOS学习,ios,uiwebview,获取标题url)