ios 用js获取网页图片的url和宽高
NSString *tempWidth;
tempWidth = [webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('img')[0].height"];
SJBLog(@"tempWidth===%@",tempWidth);
if ([tempWidth intValue] >= 150) {
self.imageStringForShare = [webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('img')[0].src"];
}else{
tempWidth = [webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('img')[1].height"];
SJBLog(@"tempWidth===%@",tempWidth);
if ([tempWidth intValue] >= 150) {
self.imageStringForShare = [webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('img')[1].src"];
}else{
tempWidth = [webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('img')[2].height"];
SJBLog(@"tempWidth===%@",tempWidth);
if ([tempWidth intValue] >= 150) {
self.imageStringForShare = [webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName('img')[2].src"];
}
}
}