首页 > 移动平台 > 详细

iOS-获取当前网页的 url 和 title 和 html

时间:2015-03-03 18:20:22      阅读:338      评论:0      收藏:0      [点我收藏+]

本文转载至 http://www.th7.cn/Program/IOS/201310/156916.shtml

 
@property (strong,nonatomic)UIWebView *webView;  

@property (strong,nonatomic)NSString *currentURL;  

@property (strong,nonatomic)NSString *currentTitle;  

@property (strong,nonatomic)NSString *currentHTML;  

-(void) webViewDidFinishLoad:(UIWebView *)webView {  

  

    [UIApplicationsharedApplication].networkActivityIndicatorVisible =NO;  

    self.title =  [webViewstringByEvaluatingJavaScriptFromString:@"document.title"];//获取当前页面的title  

      

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

    NSLog(@"title-%@--url-%@--",self.title,self.currentURL);  

  

   NSString *lJs = @"document.documentElement.innerHTML";//获取当前网页html  

   self.currentHTML = [webView stringByEvaluatingJavaScriptFromString:lJs];  

      

}  

iOS-获取当前网页的 url 和 title 和 html

原文:http://www.cnblogs.com/Camier-myNiuer/p/4311504.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!