阻止UIWebView使用其“id”加载特定图像

时间:2011-07-12 00:05:26

标签: iphone html c ios

您好我想阻止UIWebView加载特定图片,问题是图片网址会更改,但其ID(ID =“Header1_headerimg”)保持不变。

网页上的html:

< img alt="Equestria Daily" height="350px; " id="Header1_headerimg" src="http://4.bp.blogspot.com/-WS5XLbTi47E/ThdWHuLoR4I/AAAAAAAAHT8/cdqXIVfXB9k/s1600/newdefaultbannerappstra.png" style="display: block" width="1100px; ">

我想在UIWebView中阻止它。

不,我无法编辑页面html。

谢谢。

1 个答案:

答案 0 :(得分:0)

I think this would answer your question

[webview stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById('Header1_headerimg').style.display='none'"]];