#pragma mark webView delegate
- (void)webViewDidFinishLoad:(UIWebView *)webView{
//拦截网页图片 并修改图片大小
[webView stringByEvaluatingJavaScriptFromString:
[NSString stringWithFormat:@"var script = document.createElement('script');"
"script.type = 'text/javascript';"
"script.text = \"function ResizeImages() { "
"var myimg,oldwidth,oldheight;"
"var maxwidth=%f;" //缩放系数
"for(i=0;i <document.images.length;i++){"
"myimg = document.images[i];"
"if(myimg.width > maxwidth){"
"myimg.removeAttribute('width');"
"myimg.removeAttribute('height');"
"oldwidth = myimg.width;"
"oldheight = myimg.height;"
"myimg.width = maxwidth;"
"myimg.height = maxwidth * (oldheight/oldwidth);"
"}"
"}"
"}\";"
"document.getElementsByTagName('head')[0].appendChild(script);",ScreenWith-30]];
[webView stringByEvaluatingJavaScriptFromString:@"ResizeImages();"];
}