[英]How can we get the url of an image in a UIWebView?
I just want to extract the url of an image that I touched from a UIWebView. 我只想提取我从UIWebView触摸过的图像的URL。 How can we do that ? 我们该怎么做? Thanks in advance! 提前致谢!
I believe you'd have to use JavaScript to do this... or at least, that's one way of doing it. 我相信您必须使用JavaScript才能做到这一点……或者至少,这是一种实现方式。 You can have a JavaScript function (say, URLofImageClicked
) that returns the URL of the clicked image. 您可以使用JavaScript函数(例如URLofImageClicked
)来返回所单击图像的URL。 In Objective-C, you would make a call to that function using stringByEvaluatingJavaScriptFromString:
. 在Objective-C中,您将使用stringByEvaluatingJavaScriptFromString:
对该函数进行stringByEvaluatingJavaScriptFromString:
。 I would guess you would make that JavaScript call when UIWebView
detects a click. 我猜想,当UIWebView
检测到点击时,您将进行JavaScript调用。
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.