ios webview 获取 网页的URL、title和HTML
2015-07-31 15:51
771 查看
@property (strong,nonatomic)UIWebView *webView;
@property (strong,nonatomic)NSString *currentURL;
@property (strong,nonatomic)NSString *currentTitle;
@property (strong,nonatomic)NSString *currentHTML;
[objc] view plaincopy
---------------------------------
[objc]
[objc]
-(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];
}
@property (strong,nonatomic)NSString *currentURL;
@property (strong,nonatomic)NSString *currentTitle;
@property (strong,nonatomic)NSString *currentHTML;
[objc] view plaincopy
---------------------------------
[objc]
[objc]
-(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开发之:监听音量键
- Alternative access to keyboard height
- IOS 模拟器 在iPhone5和iPhone5s显示不全,不能全屏显示
- GCD ios多线程 runloop
- IOS TableView Cell重用机制
- ios 查看设备的homedirectory
- iOS Crash文件中常见的Exception Type & Exception Code
- iOS 常量和全局变量的定义
- [ios]关于gps以及坐标系
- iOS开发-Day14-OC封装
- iOS 推送学习
- ios-应用管理
- iOS 中播放gif图片
- ios NSString使用总结
- iOS中遍历数组的几种方法
- iOS文字转语音播放
- View层的组织和调用方案(中)
- ios客户端RSA公钥加密 .net后台私钥解密解决方案(基于Openssl)
- iOS画线粗细
- iOS--iOS7摄像头识别二维码功能