禁止WebView的彈跳和滾動:
[(UIScrollView *)[[webView subviews] objectAtIndex:0] setBounces:NO];
[(UIScrollView *)[[webView subviews] objectAtIndex:0] setScrollEnabled:NO];
設置UIWebView的背景顏色爲透明
[_webView setBackgroundColor:[UIColor clearColor]];
[_webView setOpaque:NO];
- (void)webViewDidFinishLoad:(UIWebView *)webView {
NSString *title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];//獲取當前頁面的title
NSString *currentURL = webView.request.URL.absoluteString;
NSLog(@"title-%@--url-%@--",title,currentURL);
NSString *lJs = @"document.documentElement.innerHTML";//獲取當前網頁的html
self.currentHTML = [webView stringByEvaluatingJavaScriptFromString:lJs];
}